2020-11-23 18:06:44 +00:00
|
|
|
pragma abicoder v2;
|
2020-11-03 15:52:04 +00:00
|
|
|
|
|
|
|
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
|
2021-04-23 15:59:01 +00:00
|
|
|
// compileToEwasm: also
|
2020-11-03 15:52:04 +00:00
|
|
|
// ----
|
|
|
|
// 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
|