2019-06-06 12:07:40 +00:00
|
|
|
contract C {
|
2019-09-18 13:38:38 +00:00
|
|
|
uint[] storageArray;
|
2019-11-07 20:22:58 +00:00
|
|
|
function set_get_length(uint256 len) public returns (uint256) {
|
|
|
|
while(storageArray.length < len)
|
|
|
|
storageArray.push();
|
2019-09-18 13:38:38 +00:00
|
|
|
return storageArray.length;
|
|
|
|
}
|
2019-06-06 12:07:40 +00:00
|
|
|
}
|
|
|
|
// ====
|
2020-11-24 23:25:42 +00:00
|
|
|
// compileViaYul: also
|
2019-06-06 12:07:40 +00:00
|
|
|
// ----
|
|
|
|
// set_get_length(uint256): 0 -> 0
|
|
|
|
// set_get_length(uint256): 1 -> 1
|
|
|
|
// set_get_length(uint256): 10 -> 10
|
|
|
|
// set_get_length(uint256): 20 -> 20
|
|
|
|
// set_get_length(uint256): 0xFF -> 0xFF
|
2021-05-18 13:39:08 +00:00
|
|
|
// gas irOptimized: 105956
|
|
|
|
// gas legacy: 126722
|
|
|
|
// gas legacyOptimized: 107818
|
2019-09-18 13:38:38 +00:00
|
|
|
// set_get_length(uint256): 0xFFF -> 0xFFF
|
2021-05-18 13:39:08 +00:00
|
|
|
// gas irOptimized: 1367718
|
|
|
|
// gas legacy: 1702119
|
|
|
|
// gas legacyOptimized: 1398420
|
2019-12-04 12:13:05 +00:00
|
|
|
// set_get_length(uint256): 0xFFFFF -> FAILURE # Out-of-gas #
|