Skip to content

Instantly share code, notes, and snippets.

@sc0Vu
Created May 7, 2019 06:02
Show Gist options
  • Save sc0Vu/652e8a28fae1ab8967fe1b1ee60ead0c to your computer and use it in GitHub Desktop.
Save sc0Vu/652e8a28fae1ab8967fe1b1ee60ead0c to your computer and use it in GitHub Desktop.
Different result when call assembly add in bytes and bytes32.
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