mirror of
https://github.com/status-im/EIPs.git
synced 2025-01-14 17:04:11 +00:00
Add comparison with current opcodes
This commit is contained in:
parent
4218665af9
commit
0b08d11f48
@ -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).
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user