Skip to content

Commit

Permalink
Explain sign of arg1/arg2
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Jul 3, 2017
1 parent e5ca919 commit 3db4f38
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions EIPS/eip-145.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ The `SHL` instruction (shift left) pops 2 values from the stack, `arg1` and `arg
(arg1 * 2^arg2) mod 2^256
```

where both `arg1` and `arg2` are considered as unsigned numbers.

Notes:
- The shift amount (`arg2`) is interpreted as an unsigned number.
- If the shift amount (`arg2`) is greater or equal 256 the result is 0.
Expand All @@ -45,6 +47,8 @@ The `SHR` instruction (logical shift right) pops 2 values from the stack, `arg1`
floor(arg1 / 2^arg2)
```

Where both `arg1` and `arg2` are considered as unsigned numbers.

Notes:
- The shift amount (`arg2`) is interpreted as an unsigned number.
- If the shift amount (`arg2`) is greater or equal 256 the result is 0.
Expand All @@ -57,6 +61,8 @@ The `SAR` instruction (arithmetic shift right) pops 2 values from the stack, `ar
floor(arg1 / 2^arg2)
```

where `arg1` is considered as a signed number and `arg2` as an unsigned number.

Notes:
- 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.
Expand Down

0 comments on commit 3db4f38

Please sign in to comment.