2020-03-09 21:14:07 +00:00
|
|
|
contract c {
|
|
|
|
bytes8[] data1; // 4 per slot
|
|
|
|
bytes10[] data2; // 3 per slot
|
|
|
|
|
|
|
|
function test()
|
|
|
|
public
|
|
|
|
returns (bytes10 a, bytes10 b, bytes10 c, bytes10 d, bytes10 e)
|
|
|
|
{
|
|
|
|
data1 = new bytes8[](9);
|
|
|
|
for (uint256 i = 0; i < data1.length; ++i) data1[i] = bytes8(uint64(i));
|
|
|
|
data2 = data1;
|
|
|
|
a = data2[1];
|
|
|
|
b = data2[2];
|
|
|
|
c = data2[3];
|
|
|
|
d = data2[4];
|
|
|
|
e = data2[5];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-03 17:56:57 +00:00
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
2020-03-09 21:14:07 +00:00
|
|
|
// ----
|
|
|
|
// test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x05000000000000000000000000000000000000000000000000
|
2021-05-18 13:39:08 +00:00
|
|
|
// gas irOptimized: 214644
|
|
|
|
// gas legacy: 221883
|
|
|
|
// gas legacyOptimized: 220734
|