Created
November 29, 2019 18:30
-
-
Save vasa-develop/3177adfe79b68b91dc41fcead13daa55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.11; | |
contract Calldata { | |
function add(uint256 _a, uint256 _b) public view returns (uint256 result) { | |
assembly{ | |
_a := mload(0x40) | |
_b := add(_a, 32) | |
calldatacopy(_a, 4, 32) | |
calldatacopy(_b, add(4, 32), 32) | |
result := add(mload(_a), mload(_b)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment