mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
20 lines
785 B
Solidity
20 lines
785 B
Solidity
|
pragma experimental ABIEncoderV2;
|
||
|
|
||
|
contract C {
|
||
|
struct S { int16 a; uint8 b; bytes2 c; }
|
||
|
function f(S memory s) public pure returns (uint a, uint b, uint c) {
|
||
|
assembly {
|
||
|
a := mload(s)
|
||
|
b := mload(add(s, 0x20))
|
||
|
c := mload(add(s, 0x40))
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
// ====
|
||
|
// compileViaYul: also
|
||
|
// ----
|
||
|
// f((int16,uint8,bytes2)): 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01, 0xff, "ab" -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01, 0xff, "ab"
|
||
|
// f((int16,uint8,bytes2)): 0xff010, 0xff, "ab" -> FAILURE
|
||
|
// f((int16,uint8,bytes2)): 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01, 0xff0002, "ab" -> FAILURE
|
||
|
// f((int16,uint8,bytes2)): 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01, 0xff, "abcd" -> FAILURE
|