mirror of
https://github.com/status-im/EIPs.git
synced 2025-01-14 17:04:11 +00:00
Clarify shift amount (arg2)
This commit is contained in:
parent
27847a875d
commit
d4f5382f51
@ -4,7 +4,7 @@
|
|||||||
Title: Bitwise shifting instructions in EVM
|
Title: Bitwise shifting instructions in EVM
|
||||||
Author: Alex Beregszaszi, Paweł Bylica
|
Author: Alex Beregszaszi, Paweł Bylica
|
||||||
Type: Standard Track
|
Type: Standard Track
|
||||||
Category Core
|
Category: Core
|
||||||
Status: Draft
|
Status: Draft
|
||||||
Created: 2017-02-13
|
Created: 2017-02-13
|
||||||
|
|
||||||
@ -34,7 +34,8 @@ The `SHL` instruction (shift left) pops 2 values from the stack, `arg1` and `arg
|
|||||||
```
|
```
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- If the shift amount is greater or equal 256 the result is 0.
|
- The shift amount (`arg2`) is interpreted as an unsigned number.
|
||||||
|
- If the shift amount (`arg2`) is greater or equal 256 the result is 0.
|
||||||
|
|
||||||
### `0x1c`: `SHR` (logical shift right)
|
### `0x1c`: `SHR` (logical shift right)
|
||||||
|
|
||||||
@ -45,7 +46,8 @@ arg1 udiv 2^arg2
|
|||||||
```
|
```
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- If the shift amount is greater or equal 256 the result is 0.
|
- The shift amount (`arg2`) is interpreted as an unsigned number.
|
||||||
|
- If the shift amount (`arg2`) is greater or equal 256 the result is 0.
|
||||||
|
|
||||||
### `0x1d`: `SAR` (arithmetic shift right)
|
### `0x1d`: `SAR` (arithmetic shift right)
|
||||||
|
|
||||||
@ -56,7 +58,7 @@ arg1 sdiv 2^arg2
|
|||||||
```
|
```
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- `arg2` is interpreted as 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 if `arg1` is non-negative or -1 if `arg1` is negative.
|
- 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.
|
||||||
|
|
||||||
The cost of the shift instructions is set at `verylow` tier (3 gas).
|
The cost of the shift instructions is set at `verylow` tier (3 gas).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user