EVM comparison opcodes: LT, GT, SLT, SGT, EQ, ISZERO.
Summary
Functions
Applies a comparison opcode to the stack (a list, top first) and returns the new stack.
Functions
@spec stack_op(non_neg_integer(), [non_neg_integer()]) :: [non_neg_integer()]
Applies a comparison opcode to the stack (a list, top first) and returns the new stack.
| Byte | Mnemonic | Operation |
|---|---|---|
| 0x10 | LT | 1 if a < b (unsigned), else 0 |
| 0x11 | GT | 1 if a > b (unsigned), else 0 |
| 0x12 | SLT | 1 if a < b (signed two's complement), else 0 |
| 0x13 | SGT | 1 if a > b (signed two's complement), else 0 |
| 0x14 | EQ | 1 if a == b, else 0 |
| 0x15 | ISZERO | 1 if a == 0, else 0 (unary) |
The interpreter has already checked that the stack holds the opcode's inputs.
iex> EEVM.Interpreter.Instructions.Comparison.stack_op(0x10, [1, 2, 9])
[1, 9]