Add comparison with current opcodes

This commit is contained in:
Alex Beregszaszi 2017-07-31 13:59:00 +01:00
parent 4218665af9
commit 0b08d11f48
1 changed files with 3 additions and 0 deletions

View File

@ -37,6 +37,7 @@ Notes:
- The value (`arg1`) is interpreted as an unsigned number.
- The shift amount (`arg2`) is interpreted as an unsigned number.
- If the shift amount (`arg2`) is greater or equal 256 the result is 0.
- This is equivalent to `SWAP1 PUSH1 2 EXP MUL`.
### `0x1c`: `SHR` (logical shift right)
@ -50,6 +51,7 @@ Notes:
- The value (`arg1`) is interpreted as an unsigned number.
- The shift amount (`arg2`) is interpreted as an unsigned number.
- If the shift amount (`arg2`) is greater or equal 256 the result is 0.
- This is equivalent to `SWAP1 PUSH1 2 EXP DIV`.
### `0x1d`: `SAR` (arithmetic shift right)
@ -63,6 +65,7 @@ Notes:
- The value (`arg1`) is interpreted as a signed number.
- The shift amount (`arg2`) is interpreted as an unsigned number.
- If the shift amount (`arg2`) is greater or equal 256 the result is 0 if `arg1` is non-negative or -1 if `arg1` is negative.
- This is **not** equivalent to `SWAP1 PUSH1 2 EXP SDIV`, since it rounds differently. See `SDIV(-1, 2) == 0`, while `SAR(-1, 1) == -1`.
The cost of the shift instructions is set at `verylow` tier (3 gas).