2019-09-13 22:54:51 +00:00
|
|
|
contract C {
|
|
|
|
bytes array;
|
|
|
|
|
|
|
|
function f() public {
|
|
|
|
array.push();
|
|
|
|
}
|
|
|
|
|
|
|
|
function g(uint x) public {
|
|
|
|
for (uint i = 0; i < x; ++i)
|
|
|
|
array.push() = bytes1(uint8(i));
|
|
|
|
}
|
|
|
|
|
|
|
|
function l() public returns (uint) {
|
|
|
|
return array.length;
|
|
|
|
}
|
|
|
|
|
|
|
|
function a(uint index) public view returns (bytes1) {
|
|
|
|
return array[index];
|
|
|
|
}
|
|
|
|
}
|
2020-12-09 18:29:11 +00:00
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
2019-09-13 22:54:51 +00:00
|
|
|
// ----
|
|
|
|
// l() -> 0
|
|
|
|
// g(uint256): 70 ->
|
2021-04-22 14:07:57 +00:00
|
|
|
// gas irOptimized: 430584
|
2021-02-12 12:45:15 +00:00
|
|
|
// gas legacy: 419791
|
2021-03-11 11:17:50 +00:00
|
|
|
// gas legacyOptimized: 415408
|
2019-09-13 22:54:51 +00:00
|
|
|
// l() -> 70
|
|
|
|
// a(uint256): 69 -> left(69)
|
|
|
|
// f() ->
|
|
|
|
// l() -> 71
|
|
|
|
// a(uint256): 70 -> 0
|