@tevm/voltaire / primitives/Int128
primitives/Int128
Type Aliases
BrandedInt128
BrandedInt128 =Defined in: src/primitives/Int128/Int128Type.ts:9 Branded Int128 typebigint&object
Type Declaration
[brand]
readonly[brand]:"Int128"
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Variables
BITS
Defined in: src/primitives/Int128/constants.js:48 Size in bitsconstBITS:number=128
Int128
Defined in: src/primitives/Int128/index.ts:103constInt128:object
Type Declaration
abs()
abs: (Absolute value of Int128value) =>BrandedInt128
Parameters
value
BrandedInt128
Input value
Returns
BrandedInt128
Absolute value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If value is MIN (abs(MIN) overflows)Example
bitLength()
bitLength: (Get bit length of Int128 valuevalue) =>number
Parameters
value
BrandedInt128
Input value
Returns
number
Number of bits needed to represent value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
BITS
BITS: number
Size in bits
bitwiseAnd()
bitwiseAnd: (Bitwise AND of Int128 valuesa,b) =>BrandedInt128
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
BrandedInt128
Result
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
bitwiseNot()
bitwiseNot: (Bitwise NOT of Int128 valuevalue) =>BrandedInt128
Parameters
value
BrandedInt128
Input value
Returns
BrandedInt128
Result
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
bitwiseOr()
bitwiseOr: (Bitwise OR of Int128 valuesa,b) =>BrandedInt128
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
BrandedInt128
Result
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
bitwiseXor()
bitwiseXor: (Bitwise XOR of Int128 valuesa,b) =>BrandedInt128
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
BrandedInt128
Result
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
dividedBy()
dividedBy: (Divide Int128 values (truncate toward zero)a,b) =>BrandedInt128
Parameters
a
BrandedInt128
Dividend
b
BrandedInt128
Divisor
Returns
BrandedInt128
Quotient (truncated toward zero)
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If divisor is zero or MIN / -1 (overflow)Example
equals()
equals: (Check Int128 equalitya,b) =>boolean
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
boolean
True if equal
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
from()
from: (Create Int128 from bigint, number, or stringvalue) =>BrandedInt128
Parameters
value
bigint, number, or decimal/hex stringstring | number | bigint
Returns
BrandedInt128
Int128 value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If value is out of range or invalidExample
fromBigInt()
fromBigInt: (Create Int128 from bigintvalue) =>BrandedInt128
Parameters
value
bigint
BigInt value
Returns
BrandedInt128
Int128 value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If value is out of rangeExample
fromBytes()
fromBytes: (Create Int128 from bytes (two’s complement, big-endian)bytes) =>BrandedInt128
Parameters
bytes
Uint8Array<ArrayBufferLike>
Byte array (16 bytes)
Returns
BrandedInt128
Int128 value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If bytes length is incorrectExample
fromHex()
fromHex: (Create Int128 from hex string (two’s complement)hex) =>BrandedInt128
Parameters
hex
string
Hex string (with or without 0x prefix)
Returns
BrandedInt128
Int128 value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If hex is invalid or out of rangeExample
fromNumber()
fromNumber: (Create Int128 from numbervalue) =>BrandedInt128
Parameters
value
number
Integer number
Returns
BrandedInt128
Int128 value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If value is not an integer or out of rangeExample
greaterThan()
greaterThan: (Check if Int128 is greater than anothera,b) =>boolean
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
boolean
True if a > b
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
isNegative()
isNegative: (Check if Int128 is negativevalue) =>boolean
Parameters
value
BrandedInt128
Input value
Returns
boolean
True if negative
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
isPositive()
isPositive: (Check if Int128 is positivevalue) =>boolean
Parameters
value
BrandedInt128
Input value
Returns
boolean
True if positive
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
isValid()
isValid: (Check if value is valid Int128value) =>boolean
Parameters
value
bigint
Value to check
Returns
boolean
True if valid Int128
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
isZero()
isZero: (Check if Int128 is zerovalue) =>boolean
Parameters
value
BrandedInt128
Input value
Returns
boolean
True if zero
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
leadingZeros()
leadingZeros: (Count leading zeros in Int128 two’s complement representationvalue) =>number
Parameters
value
BrandedInt128
Input value
Returns
number
Number of leading zero bits
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
lessThan()
lessThan: (Check if Int128 is less than anothera,b) =>boolean
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
boolean
True if a < b
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
MAX
MAX: bigint
Maximum Int128 value: 2^127 - 1
maximum()
maximum: (Return maximum of two Int128 valuesa,b) =>BrandedInt128
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
BrandedInt128
Maximum value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
MIN
MIN: bigint
Minimum Int128 value: -2^127
minimum()
minimum: (Return minimum of two Int128 valuesa,b) =>BrandedInt128
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
BrandedInt128
Minimum value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
minus()
minus: (Subtract Int128 values with wrappinga,b) =>BrandedInt128
Parameters
a
BrandedInt128
Minuend
b
BrandedInt128
Subtrahend
Returns
BrandedInt128
Difference with wrapping
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
modulo()
modulo: (Modulo Int128 values (sign follows dividend)a,b) =>BrandedInt128
Parameters
a
BrandedInt128
Dividend
b
BrandedInt128
Divisor
Returns
BrandedInt128
Remainder (sign follows dividend)
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If divisor is zeroExample
MODULO
MODULO: bigint
Modulo value for wrapping: 2^128
NEG_ONE
NEG_ONE: bigint
Negative one value
negate()
negate: (Negate Int128 value with wrappingvalue) =>BrandedInt128
Parameters
value
BrandedInt128
Input value
Returns
BrandedInt128
Negated value with wrapping
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
ONE
ONE: bigint
One value
plus()
plus: (Add Int128 values with wrappinga,b) =>BrandedInt128
Parameters
a
BrandedInt128
First operand
b
BrandedInt128
Second operand
Returns
BrandedInt128
Sum with wrapping
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
popCount()
popCount: (Count set bits in Int128 two’s complement representationvalue) =>number
Parameters
value
BrandedInt128
Input value
Returns
number
Number of set bits
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
shiftLeft()
shiftLeft: (Shift Int128 left with wrappingvalue,shift) =>BrandedInt128
Parameters
value
BrandedInt128
Value to shift
shift
Shift amountnumber | bigint
Returns
BrandedInt128
Shifted value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
shiftRight()
shiftRight: (Arithmetic right shift of Int128 (sign-preserving)value,shift) =>BrandedInt128
Parameters
value
BrandedInt128
Value to shift
shift
Shift amountnumber | bigint
Returns
BrandedInt128
Shifted value (sign-extended)
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
sign()
sign: (Get sign of Int128 valuevalue) =>-1|0|1
Parameters
value
BrandedInt128
Input value
Returns
-1 | 0 | 1
-1 for negative, 0 for zero, 1 for positive
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
SIZE
SIZE: number
Size in bytes
times()
times: (Multiply Int128 values with wrappinga,b) =>BrandedInt128
Parameters
a
BrandedInt128
First operand
b
BrandedInt128
Second operand
Returns
BrandedInt128
Product with wrapping
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
toBigInt()
toBigInt: (Convert Int128 to bigintvalue) =>bigint
Parameters
value
BrandedInt128
Int128 value
Returns
bigint
BigInt value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
toBytes()
toBytes: (Convert Int128 to bytes (two’s complement, big-endian)value) =>Uint8Array<ArrayBufferLike>
Parameters
value
BrandedInt128
Int128 value
Returns
Uint8Array<ArrayBufferLike>
Byte array (16 bytes)
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
toHex()
toHex: (Convert Int128 to hex string (two’s complement)value) =>string
Parameters
value
BrandedInt128
Int128 value
Returns
string
Hex string with 0x prefix
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
toNumber()
toNumber: (Convert Int128 to number (warns on overflow)value) =>number
Parameters
value
BrandedInt128
Int128 value
Returns
number
Number value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If value exceeds Number.MAX_SAFE_INTEGER or Number.MIN_SAFE_INTEGERExample
toString()
toString: (Convert Int128 to decimal stringvalue) =>string
Parameters
value
BrandedInt128
Int128 value
Returns
string
Decimal string
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
ZERO
ZERO: bigint
Zero value
MAX
Defined in: src/primitives/Int128/constants.js:18 Maximum Int128 value: 2^127 - 1constMAX:bigint
MIN
Defined in: src/primitives/Int128/constants.js:12 Minimum Int128 value: -2^127constMIN:bigint
MODULO
Defined in: src/primitives/Int128/constants.js:54 Modulo value for wrapping: 2^128constMODULO:bigint
NEG_ONE
Defined in: src/primitives/Int128/constants.js:36 Negative one valueconstNEG_ONE:bigint=-1n
ONE
Defined in: src/primitives/Int128/constants.js:30 One valueconstONE:bigint=1n
SIZE
Defined in: src/primitives/Int128/constants.js:42 Size in bytesconstSIZE:number=16
ZERO
Defined in: src/primitives/Int128/constants.js:24 Zero valueconstZERO:bigint=0n
Functions
abs()
abs(Defined in: src/primitives/Int128/abs.js:18 Absolute value of Int128value):BrandedInt128
Parameters
value
BrandedInt128
Input value
Returns
BrandedInt128
Absolute value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If value is MIN (abs(MIN) overflows)Example
bitLength()
bitLength(Defined in: src/primitives/Int128/bitLength.js:17 Get bit length of Int128 valuevalue):number
Parameters
value
BrandedInt128
Input value
Returns
number
Number of bits needed to represent value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
bitwiseAnd()
bitwiseAnd(Defined in: src/primitives/Int128/bitwiseAnd.js:19 Bitwise AND of Int128 valuesa,b):BrandedInt128
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
BrandedInt128
Result
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
bitwiseNot()
bitwiseNot(Defined in: src/primitives/Int128/bitwiseNot.js:17 Bitwise NOT of Int128 valuevalue):BrandedInt128
Parameters
value
BrandedInt128
Input value
Returns
BrandedInt128
Result
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
bitwiseOr()
bitwiseOr(Defined in: src/primitives/Int128/bitwiseOr.js:19 Bitwise OR of Int128 valuesa,b):BrandedInt128
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
BrandedInt128
Result
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
bitwiseXor()
bitwiseXor(Defined in: src/primitives/Int128/bitwiseXor.js:19 Bitwise XOR of Int128 valuesa,b):BrandedInt128
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
BrandedInt128
Result
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
dividedBy()
dividedBy(Defined in: src/primitives/Int128/dividedBy.js:20 Divide Int128 values (truncate toward zero)a,b):BrandedInt128
Parameters
a
BrandedInt128
Dividend
b
BrandedInt128
Divisor
Returns
BrandedInt128
Quotient (truncated toward zero)
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If divisor is zero or MIN / -1 (overflow)Example
equals()
equals(Defined in: src/primitives/Int128/equals.js:17 Check Int128 equalitya,b):boolean
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
boolean
True if equal
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
from()
from(Defined in: src/primitives/Int128/from.js:20 Create Int128 from bigint, number, or stringvalue):BrandedInt128
Parameters
value
bigint, number, or decimal/hex stringstring | number | bigint
Returns
BrandedInt128
Int128 value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If value is out of range or invalidExample
fromBigInt()
fromBigInt(Defined in: src/primitives/Int128/fromBigInt.js:18 Create Int128 from bigintvalue):BrandedInt128
Parameters
value
bigint
BigInt value
Returns
BrandedInt128
Int128 value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If value is out of rangeExample
fromBytes()
fromBytes(Defined in: src/primitives/Int128/fromBytes.js:19 Create Int128 from bytes (two’s complement, big-endian)bytes):BrandedInt128
Parameters
bytes
Uint8Array<ArrayBufferLike>
Byte array (16 bytes)
Returns
BrandedInt128
Int128 value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If bytes length is incorrectExample
fromHex()
fromHex(Defined in: src/primitives/Int128/fromHex.js:19 Create Int128 from hex string (two’s complement)hex):BrandedInt128
Parameters
hex
string
Hex string (with or without 0x prefix)
Returns
BrandedInt128
Int128 value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If hex is invalid or out of rangeExample
fromNumber()
fromNumber(Defined in: src/primitives/Int128/fromNumber.js:18 Create Int128 from numbervalue):BrandedInt128
Parameters
value
number
Integer number
Returns
BrandedInt128
Int128 value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If value is not an integer or out of rangeExample
greaterThan()
greaterThan(Defined in: src/primitives/Int128/greaterThan.js:17 Check if Int128 is greater than anothera,b):boolean
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
boolean
True if a > b
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
isNegative()
isNegative(Defined in: src/primitives/Int128/isNegative.js:15 Check if Int128 is negativevalue):boolean
Parameters
value
BrandedInt128
Input value
Returns
boolean
True if negative
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
isPositive()
isPositive(Defined in: src/primitives/Int128/isPositive.js:15 Check if Int128 is positivevalue):boolean
Parameters
value
BrandedInt128
Input value
Returns
boolean
True if positive
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
isValid()
isValid(Defined in: src/primitives/Int128/isValid.js:17 Check if value is valid Int128value):boolean
Parameters
value
bigint
Value to check
Returns
boolean
True if valid Int128
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
isZero()
isZero(Defined in: src/primitives/Int128/isZero.js:15 Check if Int128 is zerovalue):boolean
Parameters
value
BrandedInt128
Input value
Returns
boolean
True if zero
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
leadingZeros()
leadingZeros(Defined in: src/primitives/Int128/leadingZeros.js:17 Count leading zeros in Int128 two’s complement representationvalue):number
Parameters
value
BrandedInt128
Input value
Returns
number
Number of leading zero bits
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
lessThan()
lessThan(Defined in: src/primitives/Int128/lessThan.js:17 Check if Int128 is less than anothera,b):boolean
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
boolean
True if a < b
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
maximum()
maximum(Defined in: src/primitives/Int128/maximum.js:17 Return maximum of two Int128 valuesa,b):BrandedInt128
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
BrandedInt128
Maximum value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
minimum()
minimum(Defined in: src/primitives/Int128/minimum.js:17 Return minimum of two Int128 valuesa,b):BrandedInt128
Parameters
a
BrandedInt128
First value
b
BrandedInt128
Second value
Returns
BrandedInt128
Minimum value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
minus()
minus(Defined in: src/primitives/Int128/minus.js:19 Subtract Int128 values with wrappinga,b):BrandedInt128
Parameters
a
BrandedInt128
Minuend
b
BrandedInt128
Subtrahend
Returns
BrandedInt128
Difference with wrapping
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
modulo()
modulo(Defined in: src/primitives/Int128/modulo.js:18 Modulo Int128 values (sign follows dividend)a,b):BrandedInt128
Parameters
a
BrandedInt128
Dividend
b
BrandedInt128
Divisor
Returns
BrandedInt128
Remainder (sign follows dividend)
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If divisor is zeroExample
negate()
negate(Defined in: src/primitives/Int128/negate.js:19 Negate Int128 value with wrappingvalue):BrandedInt128
Parameters
value
BrandedInt128
Input value
Returns
BrandedInt128
Negated value with wrapping
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
plus()
plus(Defined in: src/primitives/Int128/plus.js:19 Add Int128 values with wrappinga,b):BrandedInt128
Parameters
a
BrandedInt128
First operand
b
BrandedInt128
Second operand
Returns
BrandedInt128
Sum with wrapping
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
popCount()
popCount(Defined in: src/primitives/Int128/popCount.js:17 Count set bits in Int128 two’s complement representationvalue):number
Parameters
value
BrandedInt128
Input value
Returns
number
Number of set bits
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
shiftLeft()
shiftLeft(Defined in: src/primitives/Int128/shiftLeft.js:18 Shift Int128 left with wrappingvalue,shift):BrandedInt128
Parameters
value
BrandedInt128
Value to shift
shift
Shift amountnumber | bigint
Returns
BrandedInt128
Shifted value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
shiftRight()
shiftRight(Defined in: src/primitives/Int128/shiftRight.js:18 Arithmetic right shift of Int128 (sign-preserving)value,shift):BrandedInt128
Parameters
value
BrandedInt128
Value to shift
shift
Shift amountnumber | bigint
Returns
BrandedInt128
Shifted value (sign-extended)
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
sign()
sign(Defined in: src/primitives/Int128/sign.js:19 Get sign of Int128 valuevalue):-1|0|1
Parameters
value
BrandedInt128
Input value
Returns
-1 | 0 | 1
-1 for negative, 0 for zero, 1 for positive
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
times()
times(Defined in: src/primitives/Int128/times.js:19 Multiply Int128 values with wrappinga,b):BrandedInt128
Parameters
a
BrandedInt128
First operand
b
BrandedInt128
Second operand
Returns
BrandedInt128
Product with wrapping
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
toBigInt()
toBigInt(Defined in: src/primitives/Int128/toBigInt.js:15 Convert Int128 to bigintvalue):bigint
Parameters
value
BrandedInt128
Int128 value
Returns
bigint
BigInt value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
toBytes()
toBytes(Defined in: src/primitives/Int128/toBytes.js:17 Convert Int128 to bytes (two’s complement, big-endian)value):Uint8Array<ArrayBufferLike>
Parameters
value
BrandedInt128
Int128 value
Returns
Uint8Array<ArrayBufferLike>
Byte array (16 bytes)
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
toHex()
toHex(Defined in: src/primitives/Int128/toHex.js:19 Convert Int128 to hex string (two’s complement)value):string
Parameters
value
BrandedInt128
Int128 value
Returns
string
Hex string with 0x prefix
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Example
toNumber()
toNumber(Defined in: src/primitives/Int128/toNumber.js:16 Convert Int128 to number (warns on overflow)value):number
Parameters
value
BrandedInt128
Int128 value
Returns
number
Number value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentationSince
0.0.0Throws
If value exceeds Number.MAX_SAFE_INTEGER or Number.MIN_SAFE_INTEGERExample
toString()
toString(Defined in: src/primitives/Int128/toString.js:16 Convert Int128 to decimal stringvalue):string
Parameters
value
BrandedInt128
Int128 value
Returns
string
Decimal string

