Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Long

Index

Constructors

constructor

  • new Long(low: number, high?: undefined | number, unsigned?: undefined | false | true): Long
  • Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs.

    Parameters

    • low: number
    • Optional high: undefined | number
    • Optional unsigned: undefined | false | true

    Returns Long

Properties

high

high: number

The high 32 bits as a signed value.

low

low: number

The low 32 bits as a signed value.

unsigned

unsigned: boolean

Whether unsigned or not.

Static MAX_UNSIGNED_VALUE

MAX_UNSIGNED_VALUE: Long

Maximum unsigned value.

Static MAX_VALUE

MAX_VALUE: Long

Maximum signed value.

Static MIN_VALUE

MIN_VALUE: Long

Minimum signed value.

Static NEG_ONE

NEG_ONE: Long

Signed negative one.

Static ONE

ONE: Long

Signed one.

Static UONE

UONE: Long

Unsigned one.

Static UZERO

UZERO: Long

Unsigned zero.

Static ZERO

ZERO: Long

Signed zero

Methods

add

  • add(addend: number | Long | string): Long
  • Returns the sum of this and the specified Long.

    Parameters

    • addend: number | Long | string

    Returns Long

and

  • and(other: Long | number | string): Long
  • Returns the bitwise AND of this Long and the specified.

    Parameters

    • other: Long | number | string

    Returns Long

comp

  • comp(other: Long | number | string): number
  • Compares this Long's value with the specified's.

    Parameters

    • other: Long | number | string

    Returns number

compare

  • compare(other: Long | number | string): number
  • Compares this Long's value with the specified's.

    Parameters

    • other: Long | number | string

    Returns number

div

  • div(divisor: Long | number | string): Long
  • Returns this Long divided by the specified.

    Parameters

    • divisor: Long | number | string

    Returns Long

divide

  • divide(divisor: Long | number | string): Long
  • Returns this Long divided by the specified.

    Parameters

    • divisor: Long | number | string

    Returns Long

eq

  • eq(other: Long | number | string): boolean
  • Tests if this Long's value equals the specified's.

    Parameters

    • other: Long | number | string

    Returns boolean

equals

  • equals(other: Long | number | string): boolean
  • Tests if this Long's value equals the specified's.

    Parameters

    • other: Long | number | string

    Returns boolean

getHighBits

  • getHighBits(): number
  • Gets the high 32 bits as a signed integer.

    Returns number

getHighBitsUnsigned

  • getHighBitsUnsigned(): number
  • Gets the high 32 bits as an unsigned integer.

    Returns number

getLowBits

  • getLowBits(): number
  • Gets the low 32 bits as a signed integer.

    Returns number

getLowBitsUnsigned

  • getLowBitsUnsigned(): number
  • Gets the low 32 bits as an unsigned integer.

    Returns number

getNumBitsAbs

  • getNumBitsAbs(): number
  • Gets the number of bits needed to represent the absolute value of this Long.

    Returns number

greaterThan

  • greaterThan(other: Long | number | string): boolean
  • Tests if this Long's value is greater than the specified's.

    Parameters

    • other: Long | number | string

    Returns boolean

greaterThanOrEqual

  • greaterThanOrEqual(other: Long | number | string): boolean
  • Tests if this Long's value is greater than or equal the specified's.

    Parameters

    • other: Long | number | string

    Returns boolean

gt

  • gt(other: Long | number | string): boolean
  • Tests if this Long's value is greater than the specified's.

    Parameters

    • other: Long | number | string

    Returns boolean

gte

  • gte(other: Long | number | string): boolean
  • Tests if this Long's value is greater than or equal the specified's.

    Parameters

    • other: Long | number | string

    Returns boolean

isEven

  • isEven(): boolean
  • Tests if this Long's value is even.

    Returns boolean

isNegative

  • isNegative(): boolean
  • Tests if this Long's value is negative.

    Returns boolean

isOdd

  • isOdd(): boolean
  • Tests if this Long's value is odd.

    Returns boolean

isPositive

  • isPositive(): boolean
  • Tests if this Long's value is positive.

    Returns boolean

isZero

  • isZero(): boolean
  • Tests if this Long's value equals zero.

    Returns boolean

lessThan

  • lessThan(other: Long | number | string): boolean
  • Tests if this Long's value is less than the specified's.

    Parameters

    • other: Long | number | string

    Returns boolean

lessThanOrEqual

  • lessThanOrEqual(other: Long | number | string): boolean
  • Tests if this Long's value is less than or equal the specified's.

    Parameters

    • other: Long | number | string

    Returns boolean

lt

  • lt(other: Long | number | string): boolean
  • Tests if this Long's value is less than the specified's.

    Parameters

    • other: Long | number | string

    Returns boolean

lte

  • lte(other: Long | number | string): boolean
  • Tests if this Long's value is less than or equal the specified's.

    Parameters

    • other: Long | number | string

    Returns boolean

mod

  • mod(other: Long | number | string): Long
  • Returns this Long modulo the specified.

    Parameters

    • other: Long | number | string

    Returns Long

modulo

  • modulo(other: Long | number | string): Long
  • Returns this Long modulo the specified.

    Parameters

    • other: Long | number | string

    Returns Long

mul

  • mul(multiplier: Long | number | string): Long
  • Returns the product of this and the specified Long.

    Parameters

    • multiplier: Long | number | string

    Returns Long

multiply

  • multiply(multiplier: Long | number | string): Long
  • Returns the product of this and the specified Long.

    Parameters

    • multiplier: Long | number | string

    Returns Long

neg

  • Negates this Long's value.

    Returns Long

negate

  • Negates this Long's value.

    Returns Long

neq

  • neq(other: Long | number | string): boolean
  • Tests if this Long's value differs from the specified's.

    Parameters

    • other: Long | number | string

    Returns boolean

not

  • Returns the bitwise NOT of this Long.

    Returns Long

notEquals

  • notEquals(other: Long | number | string): boolean
  • Tests if this Long's value differs from the specified's.

    Parameters

    • other: Long | number | string

    Returns boolean

or

  • or(other: Long | number | string): Long
  • Returns the bitwise OR of this Long and the specified.

    Parameters

    • other: Long | number | string

    Returns Long

shiftLeft

  • shiftLeft(numBits: number | Long): Long
  • Returns this Long with bits shifted to the left by the given amount.

    Parameters

    • numBits: number | Long

    Returns Long

shiftRight

  • shiftRight(numBits: number | Long): Long
  • Returns this Long with bits arithmetically shifted to the right by the given amount.

    Parameters

    • numBits: number | Long

    Returns Long

shiftRightUnsigned

  • shiftRightUnsigned(numBits: number | Long): Long
  • Returns this Long with bits logically shifted to the right by the given amount.

    Parameters

    • numBits: number | Long

    Returns Long

shl

  • Returns this Long with bits shifted to the left by the given amount.

    Parameters

    • numBits: number | Long

    Returns Long

shr

  • Returns this Long with bits arithmetically shifted to the right by the given amount.

    Parameters

    • numBits: number | Long

    Returns Long

shru

  • Returns this Long with bits logically shifted to the right by the given amount.

    Parameters

    • numBits: number | Long

    Returns Long

sub

  • sub(subtrahend: number | Long | string): Long
  • Returns the difference of this and the specified Long.

    Parameters

    • subtrahend: number | Long | string

    Returns Long

subtract

  • subtract(subtrahend: number | Long | string): Long
  • Returns the difference of this and the specified Long.

    Parameters

    • subtrahend: number | Long | string

    Returns Long

toBytes

  • toBytes(le?: undefined | false | true): number[]
  • Converts this Long to its byte representation.

    Parameters

    • Optional le: undefined | false | true

    Returns number[]

toBytesBE

  • toBytesBE(): number[]
  • Converts this Long to its big endian byte representation.

    Returns number[]

toBytesLE

  • toBytesLE(): number[]
  • Converts this Long to its little endian byte representation.

    Returns number[]

toInt

  • toInt(): number
  • Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.

    Returns number

toNumber

  • toNumber(): number
  • Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).

    Returns number

toSigned

  • Converts this Long to signed.

    Returns Long

toString

  • toString(radix?: undefined | number): string
  • Converts the Long to a string written in the specified radix.

    Parameters

    • Optional radix: undefined | number

    Returns string

toUnsigned

  • toUnsigned(): Long
  • Converts this Long to unsigned.

    Returns Long

xor

  • xor(other: Long | number | string): Long
  • Returns the bitwise XOR of this Long and the given one.

    Parameters

    • other: Long | number | string

    Returns Long

Static fromBits

  • fromBits(lowBits: number, highBits: number, unsigned?: undefined | false | true): Long
  • Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits.

    Parameters

    • lowBits: number
    • highBits: number
    • Optional unsigned: undefined | false | true

    Returns Long

Static fromBytes

  • fromBytes(bytes: number[], unsigned?: undefined | false | true, le?: undefined | false | true): Long
  • Creates a Long from its byte representation.

    Parameters

    • bytes: number[]
    • Optional unsigned: undefined | false | true
    • Optional le: undefined | false | true

    Returns Long

Static fromBytesBE

  • fromBytesBE(bytes: number[], unsigned?: undefined | false | true): Long
  • Creates a Long from its little endian byte representation.

    Parameters

    • bytes: number[]
    • Optional unsigned: undefined | false | true

    Returns Long

Static fromBytesLE

  • fromBytesLE(bytes: number[], unsigned?: undefined | false | true): Long
  • Creates a Long from its little endian byte representation.

    Parameters

    • bytes: number[]
    • Optional unsigned: undefined | false | true

    Returns Long

Static fromInt

  • fromInt(value: number, unsigned?: undefined | false | true): Long
  • Returns a Long representing the given 32 bit integer value.

    Parameters

    • value: number
    • Optional unsigned: undefined | false | true

    Returns Long

Static fromNumber

  • fromNumber(value: number, unsigned?: undefined | false | true): Long
  • Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.

    Parameters

    • value: number
    • Optional unsigned: undefined | false | true

    Returns Long

Static fromString

  • fromString(str: string, unsigned?: boolean | number, radix?: undefined | number): Long
  • Returns a Long representation of the given string, written using the specified radix.

    Parameters

    • str: string
    • Optional unsigned: boolean | number
    • Optional radix: undefined | number

    Returns Long

Static fromValue

  • fromValue(val: Long | number | string | object): Long
  • Converts the specified value to a Long.

    Parameters

    • val: Long | number | string | object

    Returns Long

Static isLong

  • isLong(obj: any): boolean
  • Tests if the specified object is a Long.

    Parameters

    • obj: any

    Returns boolean

Generated using TypeDoc