Created
May 7, 2019 06:02
-
-
Save sc0Vu/652e8a28fae1ab8967fe1b1ee60ead0c to your computer and use it in GitHub Desktop.
Different result when call assembly add in bytes and bytes32.
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.1; | |
contract ADD { | |
event Add( uint256 indexed num ); | |
function Bytes(bytes memory _t) public { | |
uint256 t; | |
assembly { | |
t := add(_t, 0) | |
} | |
emit Add(t); | |
} | |
function Bytes32(bytes32 _t) public { | |
uint256 t; | |
assembly { | |
t := add(_t, 0) | |
} | |
emit Add(t); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment