Documentation Index
Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
Use this file to discover all available pages before exploring further.
Try it Live
Run Int examples in the interactive playground
Type Definition
Brandedbigint representing signed 256-bit integer (-2^255 to 2^255-1). Implements EVM signed arithmetic with two’s complement encoding.
Range
- MIN: -2^255 =
0x8000...0000(high bit set) - MAX: 2^255-1 =
0x7fff...ffff - Size: 32 bytes (256 bits)
Quick Start
EVM SDIV (Signed Division)
Truncates toward zero (not floor division):0x05 SDIV
EVM SMOD (Signed Modulo)
Sign follows dividend (first operand):0x07 SMOD
EVM SLT/SGT (Signed Comparison)
Treats values as signed (negative < positive):0x12 SLT, 0x13 SGT
EVM SAR (Arithmetic Right Shift)
Preserves sign bit during shift:0x1D SAR (EIP-145)
API Methods
Constructors
from(value)- From bigint, number, or stringfromBigInt(value)- From bigint with validationfromNumber(value)- From number (throws if out of range)fromHex(hex)- Parse hex (two’s complement)fromBytes(bytes)- Parse bytes (two’s complement, big-endian)
Conversions
toHex(value)- To hex (two’s complement, 32 bytes)toBytes(value)- To bytes (32 bytes, two’s complement, big-endian)toBigInt(value)- To biginttoNumber(value)- To number (throws if unsafe)toString(value)- To decimal string
Arithmetic (EVM Semantics)
plus(a, b)- Add with wrappingminus(a, b)- Subtract with wrappingtimes(a, b)- Multiply with wrappingdividedBy(a, b)- EVM SDIV (truncate toward zero)modulo(a, b)- EVM SMOD (sign follows dividend)abs(value)- Absolute value (throws on MIN)negate(value)- Negate with wrapping
Comparison (EVM Semantics)
equals(a, b)- EqualitylessThan(a, b)- EVM SLT (signed less than)greaterThan(a, b)- EVM SGT (signed greater than)isZero(value)- Check if zeroisNegative(value)- Check if negativeisPositive(value)- Check if positivesign(value)- Sign indicator (-1, 0, 1)minimum(a, b)- Minimum valuemaximum(a, b)- Maximum value
Bitwise (EVM Semantics)
bitwiseAnd(a, b)- Bitwise ANDbitwiseOr(a, b)- Bitwise ORbitwiseXor(a, b)- Bitwise XORbitwiseNot(value)- Bitwise NOTshiftLeft(value, shift)- Left shiftshiftRight(value, shift)- EVM SAR (arithmetic right shift)
Utilities
bitLength(value)- Significant bit countleadingZeros(value)- Leading zero countpopCount(value)- Set bit countisValid(value)- Range validation
Two’s Complement (EVM Encoding)
EVM Edge Cases
Constants
See Also
- EIP-145: Bitwise shifting instructions - SAR specification
- EVM Opcodes - SDIV, SMOD, SLT, SGT, SAR
- Yellow Paper - Formal EVM specification
- Uint256 - Unsigned 256-bit integer

