Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Long

Hierarchy

  • Long

Index

Constructors

constructor

  • new Long(low: number, high: number, unsigned?: boolean): 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
    • high: number
    • unsigned: boolean = false

    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 Readonly MAX_UNSIGNED_VALUE

MAX_UNSIGNED_VALUE: Long = ...

Maximum unsigned value.

Static Readonly MAX_VALUE

MAX_VALUE: Long = ...

Maximum signed value.

Static Readonly MIN_VALUE

MIN_VALUE: Long = ...

Minimum signed value.

Static Readonly NEG_ONE

NEG_ONE: Long = ...

Signed negative one.

Static Readonly ONE

ONE: Long = ...

Signed one.

Static Readonly UONE

UONE: Long = ...

Unsigned one.

Static Readonly UZERO

UZERO: Long = ...

Unsigned zero.

Static Readonly ZERO

ZERO: Long = ...

Signed zero.

Methods

add

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

    Parameters

    • addend: string | number | Long

    Returns Long

and

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

    Parameters

    • other: string | number | Long

    Returns Long

compare

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

    Parameters

    • other: string | number | Long

    Returns 0 | 1 | -1

divide

  • divide(divisor: string | number | Long): Long
  • Returns this Long divided by the specified. The result is signed if this Long is signed or unsigned if this Long is unsigned.

    Parameters

    • divisor: string | number | Long

    Returns Long

equals

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

    Parameters

    • other: string | number | Long

    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: string | number | Long): boolean
  • Tests if this Long's value is greater than the specified's.

    Parameters

    • other: string | number | Long

    Returns boolean

greaterThanOrEqual

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

    Parameters

    • other: string | number | Long

    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: string | number | Long): boolean
  • Tests if this Long's value is less than the specified's.

    Parameters

    • other: string | number | Long

    Returns boolean

lessThanOrEqual

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

    Parameters

    • other: string | number | Long

    Returns boolean

modulo

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

    Parameters

    • divisor: string | number | Long

    Returns Long

multiply

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

    Parameters

    • multiplier: string | number | Long

    Returns Long

negate

not

notEquals

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

    Parameters

    • other: string | number | Long

    Returns boolean

or

  • Returns the bitwise OR of this Long and the specified.

    Parameters

    • other: string | number | Long

    Returns Long

rotateLeft

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

    Parameters

    • numBits: number | Long

    Returns Long

rotateRight

  • rotateRight(numBits: number | Long): Long
  • Returns this Long with bits rotated to the right by the given amount.

    Parameters

    • numBits: number | Long

    Returns Long

shiftLeft

  • 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

subtract

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

    Parameters

    • subtrahend: string | number | Long

    Returns Long

toBytes

  • toBytes(le?: boolean): number[]
  • Converts this Long to its byte representation.

    Parameters

    • Optional le: boolean

    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

toString

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

    Parameters

    • radix: number = 10

    Returns string

toUnsigned

xor

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

    Parameters

    • other: string | number | Long

    Returns Long

Static fromBits

  • fromBits(lowBits: number, highBits: number, unsigned?: boolean): 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: boolean

    Returns Long

Static fromBytes

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

    Parameters

    • bytes: number[]
    • Optional unsigned: boolean
    • Optional le: boolean

    Returns Long

Static fromBytesBE

  • fromBytesBE(bytes: number[], unsigned?: boolean): Long
  • Creates a Long from its big endian byte representation.

    Parameters

    • bytes: number[]
    • Optional unsigned: boolean

    Returns Long

Static fromBytesLE

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

    Parameters

    • bytes: number[]
    • Optional unsigned: boolean

    Returns Long

Static fromInt

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

    Parameters

    • value: number
    • Optional unsigned: boolean

    Returns Long

Static fromNumber

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

    Parameters

    • value: number
    • Optional unsigned: boolean

    Returns Long

Static fromString

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

    Parameters

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

    Returns Long

Static fromValue

  • fromValue(val: string | number | Long | { high: number; low: number; unsigned: boolean }, unsigned?: boolean): Long
  • Converts the specified value to a Long using the appropriate from* function for its type.

    Parameters

    • val: string | number | Long | { high: number; low: number; unsigned: boolean }
    • Optional unsigned: boolean

    Returns Long

Generated using TypeDoc