Skip to content

Instantly share code, notes, and snippets.

@vasa-develop
Created November 29, 2019 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vasa-develop/3177adfe79b68b91dc41fcead13daa55 to your computer and use it in GitHub Desktop.
Save vasa-develop/3177adfe79b68b91dc41fcead13daa55 to your computer and use it in GitHub Desktop.
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