ethereum.forks.dao_fork.vm.instructions.comparisonethereum.forks.tangerine_whistle.vm.instructions.comparison
Ethereum Virtual Machine (EVM) Comparison Instructions.
.. contents:: Table of Contents :backlinks: none :local:
Introduction
Implementations of the EVM Comparison instructions.
less_than ¶
Checks if the top element is less than the next top element. Pushes the result back on the stack.
Parameters
evm : The current EVM frame.
signed_less_than ¶
Signed less-than comparison.
Parameters
evm : The current EVM frame.
greater_than ¶
Checks if the top element is greater than the next top element. Pushes the result back on the stack.
Parameters
evm : The current EVM frame.
signed_greater_than ¶
Signed greater-than comparison.
Parameters
evm : The current EVM frame.
def signed_greater_than(evm: Evm) -> None:
| 105 | <snip> |
|---|---|
| 114 | # STACK |
| 115 | left = pop(evm.stack).to_signed() |
| 116 | right = pop(evm.stack).to_signed() |
| 117 | |
| 118 | # GAS |
| 119 | charge_gas(evm, GasCosts.OPCODE_SGT) |
| 120 | |
| 121 | # OPERATION |
| 122 | result = U256(left > right) |
| 123 | |
| 124 | push(evm.stack, result) |
| 125 | |
| 126 | # PROGRAM COUNTER |
| 127 | evm.pc += Uint(1) |
equal ¶
Checks if the top element is equal to the next top element. Pushes the result back on the stack.
Parameters
evm : The current EVM frame.
is_zero ¶
Checks if the top element is equal to 0. Pushes the result back on the stack.
Parameters
evm : The current EVM frame.