# `EEVM.Interpreter.Instructions.Comparison`
[🔗](https://github.com/mw2000/eevm/blob/v0.1.0/lib/eevm/interpreter/instructions/comparison.ex#L1)

EVM comparison opcodes: LT, GT, SLT, SGT, EQ, ISZERO.

# `stack_op`

```elixir
@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]

---

*Consult [api-reference.md](api-reference.md) for complete listing*
