Class: LongBits

util.LongBits

Helper class for working with the low and high bits of a 64 bit value.

new util.LongBits(lo, hi)

Constructs new long bits.

Parameters:
lo number

Low 32 bits, unsigned

hi number

High 32 bits, unsigned

Members

hi { number }

High bits.

lo { number }

Low bits.

util.LongBits.zero { util.LongBits }

Zero bits.

util.LongBits.zeroHash { string }

Zero hash.

Methods

length(){ number }

Calculates the length of this longbits when encoded as a varint.

Returns:
number Length

toHash(){ string }

Converts this long bits to a 8 characters long hash.

Returns:
string Hash

toLong(unsigned){ Long }

Converts this long bits to a long.

Parameters:
unsigned boolean false optional

Whether unsigned or not

Returns:
Long Long

toNumber(unsigned){ number }

Converts this long bits to a possibly unsafe JavaScript number.

Parameters:
unsigned boolean false optional

Whether unsigned or not

Returns:
number Possibly unsafe number

Zig-zag decodes this long bits.

Returns:
util.LongBits this

Zig-zag encodes this long bits.

Returns:
util.LongBits this

util.LongBits.from(value){ util.LongBits }

Constructs new long bits from a number, long or string.

Parameters:
value Long | number | string

Value

Returns:
util.LongBits Instance

util.LongBits.fromHash(hash){ util.LongBits }

Constructs new long bits from the specified 8 characters long hash.

Parameters:
hash string

Hash

Returns:
util.LongBits Bits

util.LongBits.fromNumber(value){ util.LongBits }

Constructs new long bits from the specified number.

Parameters:
value number

Value

Returns:
util.LongBits Instance