goog.math.Long
Classgoog.math.Long(low, high)
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. The internal representation of a long is the two given signed, 32-bit values. We use 32-bit pieces because these are the size of integers on which Javascript performs bit-operations. For operations like addition and multiplication, we split each number into 16-bit pieces, which can easily be multiplied within Javascript's floating-point representation without overflow or change in sign. In the algorithms below, we frequently reduce the negative case to the positive case by negating the input(s) and then post-processing the result. Note that we must ALWAYS check specially whether those values are MIN_VALUE (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as a positive number, it overflows back into a negative). Not handling this case would often result in infinite recursion.
low
{number
}
high
{number
}
.MAX_VALUE
{!goog.math.Long
}.MIN_VALUE
{!goog.math.Long
}.NEG_ONE
{!goog.math.Long
}.ONE
{!goog.math.Long
}.ZERO
{!goog.math.Long
}.add(other)
Returns the sum of this and the given Long.
other
{goog.math.Long
}
goog.math.Long
}
.and(other)
Returns the bitwise-AND of this Long and the given one.
other
{goog.math.Long
}
goog.math.Long
}
.compare(other)
Compares this Long with the given one.
other
{goog.math.Long
}
number
}
.div(other)
Returns this Long divided by the given one.
other
{goog.math.Long
}
goog.math.Long
}
.equals(other)
other
{goog.math.Long
}
boolean
}
.fromBits(lowBits, highBits)
Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.
lowBits
{number
}
highBits
{number
}
goog.math.Long
}
.fromInt(value)
Returns a Long representing the given (32-bit) integer value.
value
{number
}
goog.math.Long
}
.fromNumber(value)
Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
value
{number
}
goog.math.Long
}
.fromString(str, opt_radix)
Returns a Long representation of the given string, written using the given radix.
str
{string
}
opt_radix
{number
=}
goog.math.Long
}
.getHighBits()
number
}
.getLowBits()
number
}
.getLowBitsUnsigned()
number
}
.getNumBitsAbs()
number
}
.greaterThan(other)
other
{goog.math.Long
}
boolean
}
.greaterThanOrEqual(other)
other
{goog.math.Long
}
boolean
}
.isNegative()
boolean
}
.isOdd()
boolean
}
.isZero()
boolean
}
.lessThan(other)
other
{goog.math.Long
}
boolean
}
.lessThanOrEqual(other)
other
{goog.math.Long
}
boolean
}
.modulo(other)
Returns this Long modulo the given one.
other
{goog.math.Long
}
goog.math.Long
}
.multiply(other)
Returns the product of this and the given long.
other
{goog.math.Long
}
goog.math.Long
}
.negate()
goog.math.Long
}
.not()
goog.math.Long
}
.notEquals(other)
other
{goog.math.Long
}
boolean
}
.or(other)
Returns the bitwise-OR of this Long and the given one.
other
{goog.math.Long
}
goog.math.Long
}
.shiftLeft(numBits)
Returns this Long with bits shifted to the left by the given amount.
numBits
{number
}
goog.math.Long
}
.shiftRight(numBits)
Returns this Long with bits shifted to the right by the given amount.
numBits
{number
}
goog.math.Long
}
.shiftRightUnsigned(numBits)
Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.
numBits
{number
}
goog.math.Long
}
.subtract(other)
Returns the difference of this and the given Long.
other
{goog.math.Long
}
goog.math.Long
}
.toInt()
number
}
.toNumber()
number
}
.toString(opt_radix)
opt_radix
{number
=}
string
}
.xor(other)
Returns the bitwise-XOR of this Long and the given one.
other
{goog.math.Long
}
goog.math.Long
}