[Sol->Yul] Implementing Byte array push() and pop()

This commit is contained in:
Djordje Mijovic
2020-05-19 14:47:00 +02:00
parent a8ca8f75ff
commit d235d0c166
9 changed files with 227 additions and 28 deletions
@@ -0,0 +1,21 @@
// 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