2020-03-09 21:14:07 +00:00
|
|
|
// Tests transition between short and long encoding
|
|
|
|
contract c {
|
|
|
|
bytes data;
|
|
|
|
|
|
|
|
function test() public returns (uint256) {
|
|
|
|
for (uint8 i = 1; i < 40; i++) {
|
|
|
|
data.push(bytes1(i));
|
|
|
|
if (data.length != i) return 0x1000 + i;
|
|
|
|
if (data[data.length - 1] != bytes1(i)) return i;
|
|
|
|
}
|
|
|
|
for (uint8 i = 1; i < 40; i++)
|
|
|
|
if (data[i - 1] != bytes1(i)) return 0x1000000 + i;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2020-05-05 17:53:17 +00:00
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
2020-03-09 21:14:07 +00:00
|
|
|
// ----
|
|
|
|
// test() -> 0
|
2021-04-12 10:53:09 +00:00
|
|
|
// gas irOptimized: 394087
|
2021-02-12 12:45:15 +00:00
|
|
|
// gas legacy: 565428
|
2021-03-15 18:29:41 +00:00
|
|
|
// gas legacyOptimized: 552524
|