2020-05-05 17:53:17 +00:00
|
|
|
// Tests transition between short and long encoding both ways
|
|
|
|
contract c {
|
|
|
|
bytes data;
|
|
|
|
|
|
|
|
function test() public returns (uint256) {
|
|
|
|
for (uint8 i = 0; i < 33; i++) {
|
|
|
|
data.push(bytes1(i));
|
|
|
|
}
|
|
|
|
for (uint8 i = 0; i < data.length; i++)
|
|
|
|
if (data[i] != bytes1(i)) return i;
|
|
|
|
data.pop();
|
|
|
|
data.pop();
|
|
|
|
for (uint8 i = 0; i < data.length; i++)
|
|
|
|
if (data[i] != bytes1(i)) return i;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
|
|
|
// ----
|
|
|
|
// test() -> 0
|
2021-07-01 12:17:27 +00:00
|
|
|
// gas irOptimized: 165224
|
2021-05-18 13:39:08 +00:00
|
|
|
// gas legacy: 189715
|
|
|
|
// gas legacyOptimized: 184472
|