Skip to main content
@tevm/voltaire
@tevm/voltaire / evm / Comparison

Comparison

Functions

EQ()

EQ(frame): EvmError | null
Defined in: src/evm/comparison/0x14_EQ.js:18 EQ opcode (0x14) - Equality comparison Pops two values from stack and pushes 1 if they are equal, 0 otherwise. Comparison is bitwise equality. Gas: 3 (GasFastestStep) Stack: a b -> (a == b ? 1 : 0)

Parameters

frame
BrandedFrame Execution frame

Returns

EvmError | null Error if operation fails

GT()

GT(frame): EvmError | null
Defined in: src/evm/comparison/0x11_GT.js:18 GT opcode (0x11) - Greater than comparison (unsigned) Pops two values from stack and pushes 1 if first > second, 0 otherwise. All comparisons are unsigned 256-bit integers. Gas: 3 (GasFastestStep) Stack: a b -> (a > b ? 1 : 0)

Parameters

frame
BrandedFrame Execution frame

Returns

EvmError | null Error if operation fails

ISZERO()

ISZERO(frame): EvmError | null
Defined in: src/evm/comparison/0x15_ISZERO.js:17 ISZERO opcode (0x15) - Check if value is zero Pops one value from stack and pushes 1 if it is zero, 0 otherwise. Gas: 3 (GasFastestStep) Stack: a -> (a == 0 ? 1 : 0)

Parameters

frame
BrandedFrame Execution frame

Returns

EvmError | null Error if operation fails

LT()

LT(frame): EvmError | null
Defined in: src/evm/comparison/0x10_LT.js:18 LT opcode (0x10) - Less than comparison (unsigned) Pops two values from stack and pushes 1 if first < second, 0 otherwise. All comparisons are unsigned 256-bit integers. Gas: 3 (GasFastestStep) Stack: a b -> (a < b ? 1 : 0)

Parameters

frame
BrandedFrame Execution frame

Returns

EvmError | null Error if operation fails

SGT()

SGT(frame): EvmError | null
Defined in: src/evm/comparison/0x13_SGT.js:19 SGT opcode (0x13) - Signed greater than comparison Pops two values from stack and pushes 1 if first > second (signed), 0 otherwise. Values are interpreted as signed 256-bit two’s complement integers. Gas: 3 (GasFastestStep) Stack: a b -> (signed(a) > signed(b) ? 1 : 0)

Parameters

frame
BrandedFrame Execution frame

Returns

EvmError | null Error if operation fails

SLT()

SLT(frame): EvmError | null
Defined in: src/evm/comparison/0x12_SLT.js:19 SLT opcode (0x12) - Signed less than comparison Pops two values from stack and pushes 1 if first < second (signed), 0 otherwise. Values are interpreted as signed 256-bit two’s complement integers. Gas: 3 (GasFastestStep) Stack: a b -> (signed(a) < signed(b) ? 1 : 0)

Parameters

frame
BrandedFrame Execution frame

Returns

EvmError | null Error if operation fails

toSigned256()

toSigned256(value): bigint
Defined in: src/evm/comparison/toSigned256.js:10 Convert unsigned 256-bit BigInt to signed 256-bit BigInt Interprets the BigInt as a two’s complement signed integer. Values >= 2^255 are negative.

Parameters

value
bigint Unsigned 256-bit value

Returns

bigint Signed 256-bit value