mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
44da8507b1
Co-authored-by: Rodrigo Q. Saramago <rodrigoqsaramago@gmail.com>
27 lines
843 B
Solidity
27 lines
843 B
Solidity
contract c {
|
|
bytes8[9] data1; // 4 per slot
|
|
bytes17[10] data2; // 1 per slot, no offset counter
|
|
|
|
function test()
|
|
public
|
|
returns (bytes17 a, bytes17 b, bytes17 c, bytes17 d, bytes17 e)
|
|
{
|
|
for (uint256 i = 0; i < data1.length; ++i) data1[i] = bytes8(uint64(i));
|
|
data2[8] = data2[9] = bytes8(uint64(2));
|
|
data2 = data1;
|
|
a = data2[1];
|
|
b = data2[2];
|
|
c = data2[3];
|
|
d = data2[4];
|
|
e = data2[9];
|
|
}
|
|
}
|
|
|
|
// ====
|
|
// compileToEwasm: also
|
|
// ----
|
|
// test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x0
|
|
// gas irOptimized: 273576
|
|
// gas legacy: 283666
|
|
// gas legacyOptimized: 282023
|