You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Constructs a 64-bit two's-complement integer, given its low and high 32-bit
53
-
values as *signed* integers. See the from* functions below for more
54
-
convenient ways of constructing Longs.
55
-
56
-
The internal representation of a long is the two given signed, 32-bit values.
57
-
We use 32-bit pieces because these are the size of integers on which
58
-
Javascript performs bit-operations. For operations like addition and
59
-
multiplication, we split each number into 16-bit pieces, which can easily be
60
-
multiplied within Javascript's floating-point representation without overflow
61
-
or change in sign.
62
-
63
-
In the algorithms below, we frequently reduce the negative case to the
64
-
positive case by negating the input(s) and then post-processing the result.
65
-
Note that we must ALWAYS check specially whether those values are MIN_VALUE
66
-
(-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
67
-
a positive number, it overflows back into a negative). Not handling this
68
-
case would often result in infinite recursion.
52
+
Constructs a 64-bit two's-complement integer, given its low and high 32-bitvalues as *signed* integers. See the from* functions below for moreconvenient 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 whichJavascript performs bit-operations. For operations like addition andmultiplication, we split each number into 16-bit pieces, which can easily bemultiplied within Javascript's floating-point representation without overflowor change in sign.In the algorithms below, we frequently reduce the negative case to thepositive 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 asa positive number, it overflows back into a negative). Not handling thiscase would often result in infinite recursion.
0 commit comments