@tevm/voltaire / primitives/Int64
primitives/Int64
Type Aliases
BrandedInt64
BrandedInt64 =Defined in: src/primitives/Int64/Int64Type.ts:25 A signed 64-bit integer branded type. Internally a JavaScript bigint constrained to [-2^63, 2^63-1].bigint&object
Type Declaration
[brand]
readonly[brand]:"Int64"
Variables
INT64_MAX
Defined in: src/primitives/Int64/Int64Type.ts:30constINT64_MAX:9223372036854775807n=9223372036854775807n
INT64_MIN
Defined in: src/primitives/Int64/Int64Type.ts:29constINT64_MIN:-9223372036854775808n=-9223372036854775808n
MAX
Defined in: src/primitives/Int64/constants.js:11constMAX:9223372036854775807n
MIN
Defined in: src/primitives/Int64/constants.js:8constMIN:-9223372036854775808n
MINUS_ONE
Defined in: src/primitives/Int64/constants.js:20constMINUS_ONE:-1n
ONE
Defined in: src/primitives/Int64/constants.js:17constONE:1n
SIZE
Defined in: src/primitives/Int64/constants.js:23constSIZE:8=8
ZERO
Defined in: src/primitives/Int64/constants.js:14constZERO:0n
Functions
abs()
abs(Defined in: src/primitives/Int64/abs.js:8 Get absolute value of Int64value):BrandedInt64
Parameters
value
BrandedInt64
Value
Returns
BrandedInt64
Absolute value
Throws
If value is MIN (abs would overflow)bitwiseAnd()
bitwiseAnd(Defined in: src/primitives/Int64/bitwiseAnd.js:8 Bitwise AND of two Int64 valuesa,b):BrandedInt64
Parameters
a
BrandedInt64
First value
b
BrandedInt64
Second value
Returns
BrandedInt64
Result
bitwiseNot()
bitwiseNot(Defined in: src/primitives/Int64/bitwiseNot.js:7 Bitwise NOT of Int64 valuevalue):BrandedInt64
Parameters
value
BrandedInt64
Value
Returns
BrandedInt64
Result
bitwiseOr()
bitwiseOr(Defined in: src/primitives/Int64/bitwiseOr.js:8 Bitwise OR of two Int64 valuesa,b):BrandedInt64
Parameters
a
BrandedInt64
First value
b
BrandedInt64
Second value
Returns
BrandedInt64
Result
bitwiseXor()
bitwiseXor(Defined in: src/primitives/Int64/bitwiseXor.js:8 Bitwise XOR of two Int64 valuesa,b):BrandedInt64
Parameters
a
BrandedInt64
First value
b
BrandedInt64
Second value
Returns
BrandedInt64
Result
clone()
clone(Defined in: src/primitives/Int64/clone.js:7 Clone Int64 valuevalue):BrandedInt64
Parameters
value
BrandedInt64
Value to clone
Returns
BrandedInt64
Cloned value
dividedBy()
dividedBy(Defined in: src/primitives/Int64/dividedBy.js:9 Divide two Int64 values (truncates toward zero)a,b):BrandedInt64
Parameters
a
BrandedInt64
Dividend
b
BrandedInt64
Divisor
Returns
BrandedInt64
Quotient
Throws
If divisor is zero or overflow occursequals()
equals(Defined in: src/primitives/Int64/equals.js:8 Check if two Int64 values are equala,b):boolean
Parameters
a
BrandedInt64
First value
b
BrandedInt64
Second value
Returns
boolean
True if equal
from()
from(Defined in: src/primitives/Int64/from.js:15 Create Int64 from various input typesvalue):BrandedInt64
Parameters
value
Value to convertstring | number | bigint
Returns
BrandedInt64
Int64 value
Throws
If value is out of rangeExample
fromBigInt()
fromBigInt(Defined in: src/primitives/Int64/fromBigInt.js:8 Create Int64 from bigintvalue):BrandedInt64
Parameters
value
bigint
BigInt to convert
Returns
BrandedInt64
Int64 value
Throws
If value is out of rangefromBytes()
fromBytes(Defined in: src/primitives/Int64/fromBytes.js:8 Create Int64 from bytes (big-endian, two’s complement)bytes):BrandedInt64
Parameters
bytes
Uint8Array<ArrayBufferLike>
Bytes to convert (up to 8 bytes)
Returns
BrandedInt64
Int64 value
Throws
If bytes length exceeds 8fromHex()
fromHex(Defined in: src/primitives/Int64/fromHex.js:8 Create Int64 from hex string (two’s complement)hex):BrandedInt64
Parameters
hex
string
Hex string (with or without 0x prefix)
Returns
BrandedInt64
Int64 value
Throws
If hex is invalid or exceeds 8 bytesfromNumber()
fromNumber(Defined in: src/primitives/Int64/fromNumber.js:8 Create Int64 from numbervalue):BrandedInt64
Parameters
value
number
Number to convert
Returns
BrandedInt64
Int64 value
Throws
If value is out of range or NaNgreaterThan()
greaterThan(Defined in: src/primitives/Int64/greaterThan.js:8 Check if first Int64 is greater than seconda,b):boolean
Parameters
a
BrandedInt64
First value
b
BrandedInt64
Second value
Returns
boolean
True if a > b
isNegative()
isNegative(Defined in: src/primitives/Int64/isNegative.js:7 Check if Int64 value is negativevalue):boolean
Parameters
value
BrandedInt64
Value
Returns
boolean
True if negative
isPositive()
isPositive(Defined in: src/primitives/Int64/isPositive.js:7 Check if Int64 value is positivevalue):boolean
Parameters
value
BrandedInt64
Value
Returns
boolean
True if positive
isValid()
isValid(Defined in: src/primitives/Int64/isValid.js:7 Check if value is a valid Int64value):boolean
Parameters
value
unknown
Value to check
Returns
boolean
True if valid Int64
isZero()
isZero(Defined in: src/primitives/Int64/isZero.js:7 Check if Int64 value is zerovalue):boolean
Parameters
value
BrandedInt64
Value
Returns
boolean
True if zero
lessThan()
lessThan(Defined in: src/primitives/Int64/lessThan.js:8 Check if first Int64 is less than seconda,b):boolean
Parameters
a
BrandedInt64
First value
b
BrandedInt64
Second value
Returns
boolean
True if a < b
maximum()
maximum(Defined in: src/primitives/Int64/maximum.js:8 Get maximum of two Int64 valuesa,b):BrandedInt64
Parameters
a
BrandedInt64
First value
b
BrandedInt64
Second value
Returns
BrandedInt64
Maximum value
minimum()
minimum(Defined in: src/primitives/Int64/minimum.js:8 Get minimum of two Int64 valuesa,b):BrandedInt64
Parameters
a
BrandedInt64
First value
b
BrandedInt64
Second value
Returns
BrandedInt64
Minimum value
minus()
minus(Defined in: src/primitives/Int64/minus.js:9 Subtract two Int64 valuesa,b):BrandedInt64
Parameters
a
BrandedInt64
First value
b
BrandedInt64
Second value
Returns
BrandedInt64
Result
Throws
If result overflowsmodulo()
modulo(Defined in: src/primitives/Int64/modulo.js:9 Compute modulo of two Int64 valuesa,b):BrandedInt64
Parameters
a
BrandedInt64
Dividend
b
BrandedInt64
Divisor
Returns
BrandedInt64
Remainder
Throws
If divisor is zeronegate()
negate(Defined in: src/primitives/Int64/negate.js:8 Negate Int64 valuevalue):BrandedInt64
Parameters
value
BrandedInt64
Value
Returns
BrandedInt64
Negated value
Throws
If value is MIN (negation would overflow)plus()
plus(Defined in: src/primitives/Int64/plus.js:9 Add two Int64 valuesa,b):BrandedInt64
Parameters
a
BrandedInt64
First value
b
BrandedInt64
Second value
Returns
BrandedInt64
Result
Throws
If result overflowsshiftLeft()
shiftLeft(Defined in: src/primitives/Int64/shiftLeft.js:8 Shift Int64 left by n bitsvalue,n):BrandedInt64
Parameters
value
BrandedInt64
Value to shift
n
bigint
Number of bits to shift
Returns
BrandedInt64
Result
shiftRight()
shiftRight(Defined in: src/primitives/Int64/shiftRight.js:8 Arithmetic shift Int64 right by n bits (preserves sign)value,n):BrandedInt64
Parameters
value
BrandedInt64
Value to shift
n
bigint
Number of bits to shift
Returns
BrandedInt64
Result
sign()
sign(Defined in: src/primitives/Int64/sign.js:7 Get sign of Int64 valuevalue):-1|0|1
Parameters
value
BrandedInt64
Value
Returns
-1 | 0 | 1
-1 if negative, 0 if zero, 1 if positive
times()
times(Defined in: src/primitives/Int64/times.js:9 Multiply two Int64 valuesa,b):BrandedInt64
Parameters
a
BrandedInt64
First value
b
BrandedInt64
Second value
Returns
BrandedInt64
Result
Throws
If result overflowstoBigInt()
toBigInt(Defined in: src/primitives/Int64/toBigInt.js:7 Convert Int64 to bigintvalue):bigint
Parameters
value
BrandedInt64
Int64 value
Returns
bigint
BigInt value
toBytes()
toBytes(Defined in: src/primitives/Int64/toBytes.js:7 Convert Int64 to bytes (big-endian, two’s complement, 8 bytes)value):Uint8Array<ArrayBufferLike>
Parameters
value
BrandedInt64
Int64 value
Returns
Uint8Array<ArrayBufferLike>
8-byte Uint8Array
toHex()
toHex(Defined in: src/primitives/Int64/toHex.js:7 Convert Int64 to hex string (two’s complement)value):string
Parameters
value
BrandedInt64
Int64 value
Returns
string
Hex string with 0x prefix
toNumber()
toNumber(Defined in: src/primitives/Int64/toNumber.js:8 Convert Int64 to numbervalue):number
Parameters
value
BrandedInt64
Int64 value
Returns
number
Number value
Throws
If value exceeds safe integer rangetoString()
toString(Defined in: src/primitives/Int64/toString.js:8 Convert Int64 to stringvalue):string
Parameters
value
BrandedInt64
Int64 value
Returns
string
String representation
