Skip to main content
@tevm/voltaire
@tevm/voltaire / primitives/Int128

primitives/Int128

Type Aliases

BrandedInt128

BrandedInt128 = bigint & object
Defined in: src/primitives/Int128/Int128Type.ts:9 Branded Int128 type

Type Declaration

[brand]
readonly [brand]: "Int128"

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Variables

BITS

const BITS: number = 128
Defined in: src/primitives/Int128/constants.js:48 Size in bits

Int128

const Int128: object
Defined in: src/primitives/Int128/index.ts:103

Type Declaration

abs()
abs: (value) => BrandedInt128
Absolute value of Int128
Parameters
value
BrandedInt128 Input value
Returns
BrandedInt128 Absolute value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Throws
If value is MIN (abs(MIN) overflows)
Example
bitLength()
bitLength: (value) => number
Get bit length of Int128 value
Parameters
value
BrandedInt128 Input value
Returns
number Number of bits needed to represent value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
BITS
BITS: number
Size in bits
bitwiseAnd()
bitwiseAnd: (a, b) => BrandedInt128
Bitwise AND of Int128 values
Parameters
a
BrandedInt128 First value
b
BrandedInt128 Second value
Returns
BrandedInt128 Result
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
bitwiseNot()
bitwiseNot: (value) => BrandedInt128
Bitwise NOT of Int128 value
Parameters
value
BrandedInt128 Input value
Returns
BrandedInt128 Result
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
bitwiseOr()
bitwiseOr: (a, b) => BrandedInt128
Bitwise OR of Int128 values
Parameters
a
BrandedInt128 First value
b
BrandedInt128 Second value
Returns
BrandedInt128 Result
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
bitwiseXor()
bitwiseXor: (a, b) => BrandedInt128
Bitwise XOR of Int128 values
Parameters
a
BrandedInt128 First value
b
BrandedInt128 Second value
Returns
BrandedInt128 Result
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
dividedBy()
dividedBy: (a, b) => BrandedInt128
Divide Int128 values (truncate toward zero)
Parameters
a
BrandedInt128 Dividend
b
BrandedInt128 Divisor
Returns
BrandedInt128 Quotient (truncated toward zero)
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Throws
If divisor is zero or MIN / -1 (overflow)
Example
equals()
equals: (a, b) => boolean
Check Int128 equality
Parameters
a
BrandedInt128 First value
b
BrandedInt128 Second value
Returns
boolean True if equal
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
from()
from: (value) => BrandedInt128
Create Int128 from bigint, number, or string
Parameters
value
bigint, number, or decimal/hex string string | number | bigint
Returns
BrandedInt128 Int128 value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Throws
If value is out of range or invalid
Example
fromBigInt()
fromBigInt: (value) => BrandedInt128
Create Int128 from bigint
Parameters
value
bigint BigInt value
Returns
BrandedInt128 Int128 value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Throws
If value is out of range
Example
fromBytes()
fromBytes: (bytes) => BrandedInt128
Create Int128 from bytes (two’s complement, big-endian)
Parameters
bytes
Uint8Array<ArrayBufferLike> Byte array (16 bytes)
Returns
BrandedInt128 Int128 value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Throws
If bytes length is incorrect
Example
fromHex()
fromHex: (hex) => BrandedInt128
Create Int128 from hex string (two’s complement)
Parameters
hex
string Hex string (with or without 0x prefix)
Returns
BrandedInt128 Int128 value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Throws
If hex is invalid or out of range
Example
fromNumber()
fromNumber: (value) => BrandedInt128
Create Int128 from number
Parameters
value
number Integer number
Returns
BrandedInt128 Int128 value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Throws
If value is not an integer or out of range
Example
greaterThan()
greaterThan: (a, b) => boolean
Check if Int128 is greater than another
Parameters
a
BrandedInt128 First value
b
BrandedInt128 Second value
Returns
boolean True if a > b
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
isNegative()
isNegative: (value) => boolean
Check if Int128 is negative
Parameters
value
BrandedInt128 Input value
Returns
boolean True if negative
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
isPositive()
isPositive: (value) => boolean
Check if Int128 is positive
Parameters
value
BrandedInt128 Input value
Returns
boolean True if positive
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
isValid()
isValid: (value) => boolean
Check if value is valid Int128
Parameters
value
bigint Value to check
Returns
boolean True if valid Int128
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
isZero()
isZero: (value) => boolean
Check if Int128 is zero
Parameters
value
BrandedInt128 Input value
Returns
boolean True if zero
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
leadingZeros()
leadingZeros: (value) => number
Count leading zeros in Int128 two’s complement representation
Parameters
value
BrandedInt128 Input value
Returns
number Number of leading zero bits
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
lessThan()
lessThan: (a, b) => boolean
Check if Int128 is less than another
Parameters
a
BrandedInt128 First value
b
BrandedInt128 Second value
Returns
boolean True if a < b
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
MAX
MAX: bigint
Maximum Int128 value: 2^127 - 1
maximum()
maximum: (a, b) => BrandedInt128
Return maximum of two Int128 values
Parameters
a
BrandedInt128 First value
b
BrandedInt128 Second value
Returns
BrandedInt128 Maximum value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
MIN
MIN: bigint
Minimum Int128 value: -2^127
minimum()
minimum: (a, b) => BrandedInt128
Return minimum of two Int128 values
Parameters
a
BrandedInt128 First value
b
BrandedInt128 Second value
Returns
BrandedInt128 Minimum value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
minus()
minus: (a, b) => BrandedInt128
Subtract Int128 values with wrapping
Parameters
a
BrandedInt128 Minuend
b
BrandedInt128 Subtrahend
Returns
BrandedInt128 Difference with wrapping
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
modulo()
modulo: (a, b) => BrandedInt128
Modulo Int128 values (sign follows dividend)
Parameters
a
BrandedInt128 Dividend
b
BrandedInt128 Divisor
Returns
BrandedInt128 Remainder (sign follows dividend)
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Throws
If divisor is zero
Example
MODULO
MODULO: bigint
Modulo value for wrapping: 2^128
NEG_ONE
NEG_ONE: bigint
Negative one value
negate()
negate: (value) => BrandedInt128
Negate Int128 value with wrapping
Parameters
value
BrandedInt128 Input value
Returns
BrandedInt128 Negated value with wrapping
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
ONE
ONE: bigint
One value
plus()
plus: (a, b) => BrandedInt128
Add Int128 values with wrapping
Parameters
a
BrandedInt128 First operand
b
BrandedInt128 Second operand
Returns
BrandedInt128 Sum with wrapping
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
popCount()
popCount: (value) => number
Count set bits in Int128 two’s complement representation
Parameters
value
BrandedInt128 Input value
Returns
number Number of set bits
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
shiftLeft()
shiftLeft: (value, shift) => BrandedInt128
Shift Int128 left with wrapping
Parameters
value
BrandedInt128 Value to shift
shift
Shift amount number | bigint
Returns
BrandedInt128 Shifted value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
shiftRight()
shiftRight: (value, shift) => BrandedInt128
Arithmetic right shift of Int128 (sign-preserving)
Parameters
value
BrandedInt128 Value to shift
shift
Shift amount number | bigint
Returns
BrandedInt128 Shifted value (sign-extended)
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
sign()
sign: (value) => -1 | 0 | 1
Get sign of Int128 value
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 documentation
Since
0.0.0
Example
SIZE
SIZE: number
Size in bytes
times()
times: (a, b) => BrandedInt128
Multiply Int128 values with wrapping
Parameters
a
BrandedInt128 First operand
b
BrandedInt128 Second operand
Returns
BrandedInt128 Product with wrapping
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
toBigInt()
toBigInt: (value) => bigint
Convert Int128 to bigint
Parameters
value
BrandedInt128 Int128 value
Returns
bigint BigInt value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
toBytes()
toBytes: (value) => Uint8Array<ArrayBufferLike>
Convert Int128 to bytes (two’s complement, big-endian)
Parameters
value
BrandedInt128 Int128 value
Returns
Uint8Array<ArrayBufferLike> Byte array (16 bytes)
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
toHex()
toHex: (value) => string
Convert Int128 to hex string (two’s complement)
Parameters
value
BrandedInt128 Int128 value
Returns
string Hex string with 0x prefix
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
toNumber()
toNumber: (value) => number
Convert Int128 to number (warns on overflow)
Parameters
value
BrandedInt128 Int128 value
Returns
number Number value
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Throws
If value exceeds Number.MAX_SAFE_INTEGER or Number.MIN_SAFE_INTEGER
Example
toString()
toString: (value) => string
Convert Int128 to decimal string
Parameters
value
BrandedInt128 Int128 value
Returns
string Decimal string
See
https://voltaire.tevm.sh/primitives/int128 for Int128 documentation
Since
0.0.0
Example
ZERO
ZERO: bigint
Zero value

MAX

const MAX: bigint
Defined in: src/primitives/Int128/constants.js:18 Maximum Int128 value: 2^127 - 1

MIN

const MIN: bigint
Defined in: src/primitives/Int128/constants.js:12 Minimum Int128 value: -2^127

MODULO

const MODULO: bigint
Defined in: src/primitives/Int128/constants.js:54 Modulo value for wrapping: 2^128

NEG_ONE

const NEG_ONE: bigint = -1n
Defined in: src/primitives/Int128/constants.js:36 Negative one value

ONE

const ONE: bigint = 1n
Defined in: src/primitives/Int128/constants.js:30 One value

SIZE

const SIZE: number = 16
Defined in: src/primitives/Int128/constants.js:42 Size in bytes

ZERO

const ZERO: bigint = 0n
Defined in: src/primitives/Int128/constants.js:24 Zero value

Functions

abs()

abs(value): BrandedInt128
Defined in: src/primitives/Int128/abs.js:18 Absolute value of Int128

Parameters

value
BrandedInt128 Input value

Returns

BrandedInt128 Absolute value

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Throws

If value is MIN (abs(MIN) overflows)

Example


bitLength()

bitLength(value): number
Defined in: src/primitives/Int128/bitLength.js:17 Get bit length of Int128 value

Parameters

value
BrandedInt128 Input value

Returns

number Number of bits needed to represent value

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


bitwiseAnd()

bitwiseAnd(a, b): BrandedInt128
Defined in: src/primitives/Int128/bitwiseAnd.js:19 Bitwise AND of Int128 values

Parameters

a
BrandedInt128 First value
b
BrandedInt128 Second value

Returns

BrandedInt128 Result

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


bitwiseNot()

bitwiseNot(value): BrandedInt128
Defined in: src/primitives/Int128/bitwiseNot.js:17 Bitwise NOT of Int128 value

Parameters

value
BrandedInt128 Input value

Returns

BrandedInt128 Result

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


bitwiseOr()

bitwiseOr(a, b): BrandedInt128
Defined in: src/primitives/Int128/bitwiseOr.js:19 Bitwise OR of Int128 values

Parameters

a
BrandedInt128 First value
b
BrandedInt128 Second value

Returns

BrandedInt128 Result

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


bitwiseXor()

bitwiseXor(a, b): BrandedInt128
Defined in: src/primitives/Int128/bitwiseXor.js:19 Bitwise XOR of Int128 values

Parameters

a
BrandedInt128 First value
b
BrandedInt128 Second value

Returns

BrandedInt128 Result

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


dividedBy()

dividedBy(a, b): BrandedInt128
Defined in: src/primitives/Int128/dividedBy.js:20 Divide Int128 values (truncate toward zero)

Parameters

a
BrandedInt128 Dividend
b
BrandedInt128 Divisor

Returns

BrandedInt128 Quotient (truncated toward zero)

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Throws

If divisor is zero or MIN / -1 (overflow)

Example


equals()

equals(a, b): boolean
Defined in: src/primitives/Int128/equals.js:17 Check Int128 equality

Parameters

a
BrandedInt128 First value
b
BrandedInt128 Second value

Returns

boolean True if equal

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


from()

from(value): BrandedInt128
Defined in: src/primitives/Int128/from.js:20 Create Int128 from bigint, number, or string

Parameters

value
bigint, number, or decimal/hex string string | number | bigint

Returns

BrandedInt128 Int128 value

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Throws

If value is out of range or invalid

Example


fromBigInt()

fromBigInt(value): BrandedInt128
Defined in: src/primitives/Int128/fromBigInt.js:18 Create Int128 from bigint

Parameters

value
bigint BigInt value

Returns

BrandedInt128 Int128 value

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Throws

If value is out of range

Example


fromBytes()

fromBytes(bytes): BrandedInt128
Defined in: src/primitives/Int128/fromBytes.js:19 Create Int128 from bytes (two’s complement, big-endian)

Parameters

bytes
Uint8Array<ArrayBufferLike> Byte array (16 bytes)

Returns

BrandedInt128 Int128 value

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Throws

If bytes length is incorrect

Example


fromHex()

fromHex(hex): BrandedInt128
Defined in: src/primitives/Int128/fromHex.js:19 Create Int128 from hex string (two’s complement)

Parameters

hex
string Hex string (with or without 0x prefix)

Returns

BrandedInt128 Int128 value

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Throws

If hex is invalid or out of range

Example


fromNumber()

fromNumber(value): BrandedInt128
Defined in: src/primitives/Int128/fromNumber.js:18 Create Int128 from number

Parameters

value
number Integer number

Returns

BrandedInt128 Int128 value

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Throws

If value is not an integer or out of range

Example


greaterThan()

greaterThan(a, b): boolean
Defined in: src/primitives/Int128/greaterThan.js:17 Check if Int128 is greater than another

Parameters

a
BrandedInt128 First value
b
BrandedInt128 Second value

Returns

boolean True if a > b

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


isNegative()

isNegative(value): boolean
Defined in: src/primitives/Int128/isNegative.js:15 Check if Int128 is negative

Parameters

value
BrandedInt128 Input value

Returns

boolean True if negative

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


isPositive()

isPositive(value): boolean
Defined in: src/primitives/Int128/isPositive.js:15 Check if Int128 is positive

Parameters

value
BrandedInt128 Input value

Returns

boolean True if positive

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


isValid()

isValid(value): boolean
Defined in: src/primitives/Int128/isValid.js:17 Check if value is valid Int128

Parameters

value
bigint Value to check

Returns

boolean True if valid Int128

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


isZero()

isZero(value): boolean
Defined in: src/primitives/Int128/isZero.js:15 Check if Int128 is zero

Parameters

value
BrandedInt128 Input value

Returns

boolean True if zero

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


leadingZeros()

leadingZeros(value): number
Defined in: src/primitives/Int128/leadingZeros.js:17 Count leading zeros in Int128 two’s complement representation

Parameters

value
BrandedInt128 Input value

Returns

number Number of leading zero bits

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


lessThan()

lessThan(a, b): boolean
Defined in: src/primitives/Int128/lessThan.js:17 Check if Int128 is less than another

Parameters

a
BrandedInt128 First value
b
BrandedInt128 Second value

Returns

boolean True if a < b

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


maximum()

maximum(a, b): BrandedInt128
Defined in: src/primitives/Int128/maximum.js:17 Return maximum of two Int128 values

Parameters

a
BrandedInt128 First value
b
BrandedInt128 Second value

Returns

BrandedInt128 Maximum value

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


minimum()

minimum(a, b): BrandedInt128
Defined in: src/primitives/Int128/minimum.js:17 Return minimum of two Int128 values

Parameters

a
BrandedInt128 First value
b
BrandedInt128 Second value

Returns

BrandedInt128 Minimum value

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


minus()

minus(a, b): BrandedInt128
Defined in: src/primitives/Int128/minus.js:19 Subtract Int128 values with wrapping

Parameters

a
BrandedInt128 Minuend
b
BrandedInt128 Subtrahend

Returns

BrandedInt128 Difference with wrapping

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


modulo()

modulo(a, b): BrandedInt128
Defined in: src/primitives/Int128/modulo.js:18 Modulo Int128 values (sign follows dividend)

Parameters

a
BrandedInt128 Dividend
b
BrandedInt128 Divisor

Returns

BrandedInt128 Remainder (sign follows dividend)

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Throws

If divisor is zero

Example


negate()

negate(value): BrandedInt128
Defined in: src/primitives/Int128/negate.js:19 Negate Int128 value with wrapping

Parameters

value
BrandedInt128 Input value

Returns

BrandedInt128 Negated value with wrapping

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


plus()

plus(a, b): BrandedInt128
Defined in: src/primitives/Int128/plus.js:19 Add Int128 values with wrapping

Parameters

a
BrandedInt128 First operand
b
BrandedInt128 Second operand

Returns

BrandedInt128 Sum with wrapping

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


popCount()

popCount(value): number
Defined in: src/primitives/Int128/popCount.js:17 Count set bits in Int128 two’s complement representation

Parameters

value
BrandedInt128 Input value

Returns

number Number of set bits

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


shiftLeft()

shiftLeft(value, shift): BrandedInt128
Defined in: src/primitives/Int128/shiftLeft.js:18 Shift Int128 left with wrapping

Parameters

value
BrandedInt128 Value to shift
shift
Shift amount number | bigint

Returns

BrandedInt128 Shifted value

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


shiftRight()

shiftRight(value, shift): BrandedInt128
Defined in: src/primitives/Int128/shiftRight.js:18 Arithmetic right shift of Int128 (sign-preserving)

Parameters

value
BrandedInt128 Value to shift
shift
Shift amount number | bigint

Returns

BrandedInt128 Shifted value (sign-extended)

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


sign()

sign(value): -1 | 0 | 1
Defined in: src/primitives/Int128/sign.js:19 Get sign of Int128 value

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 documentation

Since

0.0.0

Example


times()

times(a, b): BrandedInt128
Defined in: src/primitives/Int128/times.js:19 Multiply Int128 values with wrapping

Parameters

a
BrandedInt128 First operand
b
BrandedInt128 Second operand

Returns

BrandedInt128 Product with wrapping

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


toBigInt()

toBigInt(value): bigint
Defined in: src/primitives/Int128/toBigInt.js:15 Convert Int128 to bigint

Parameters

value
BrandedInt128 Int128 value

Returns

bigint BigInt value

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


toBytes()

toBytes(value): Uint8Array<ArrayBufferLike>
Defined in: src/primitives/Int128/toBytes.js:17 Convert Int128 to bytes (two’s complement, big-endian)

Parameters

value
BrandedInt128 Int128 value

Returns

Uint8Array<ArrayBufferLike> Byte array (16 bytes)

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


toHex()

toHex(value): string
Defined in: src/primitives/Int128/toHex.js:19 Convert Int128 to hex string (two’s complement)

Parameters

value
BrandedInt128 Int128 value

Returns

string Hex string with 0x prefix

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example


toNumber()

toNumber(value): number
Defined in: src/primitives/Int128/toNumber.js:16 Convert Int128 to number (warns on overflow)

Parameters

value
BrandedInt128 Int128 value

Returns

number Number value

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Throws

If value exceeds Number.MAX_SAFE_INTEGER or Number.MIN_SAFE_INTEGER

Example


toString()

toString(value): string
Defined in: src/primitives/Int128/toString.js:16 Convert Int128 to decimal string

Parameters

value
BrandedInt128 Int128 value

Returns

string Decimal string

See

https://voltaire.tevm.sh/primitives/int128 for Int128 documentation

Since

0.0.0

Example