solidity/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol

25 lines
616 B
Solidity
Raw Normal View History

// 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-04-12 10:53:09 +00:00
// gas irOptimized: 309167
2021-02-12 12:45:15 +00:00
// gas legacy: 483915
// gas legacyOptimized: 478672