Skip to content

Commit

Permalink
Post-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Jun 7, 2014
2 parents 2b19314 + 2484cb6 commit 1c2e981
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 47 deletions.
2 changes: 1 addition & 1 deletion Long.js
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@
}
if (this.equals(Long.MIN_SIGNED_VALUE)) {
if (other.equals(Long.ONE) || other.equals(Long.NEG_ONE)) {
return min; // recall that -MIN_VALUE == MIN_VALUE
return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
} else if (other.equals(Long.MIN_VALUE)) {
return Long.ONE;
} else {
Expand Down
28 changes: 15 additions & 13 deletions Long.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 9 additions & 33 deletions docs/Long.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,7 @@ <h4 class="name" id="Long"><span class="type-signature"></span>new Long<span cla


<div class="description">
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.
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.
</div>


Expand Down Expand Up @@ -773,8 +757,7 @@ <h4 class="name" id="from28Bits"><span class="type-signature">&lt;static> </span


<div class="description">
Returns a Long representing the 64bit integer that comes by concatenating the given low, middle and high bits.
Each is assumed to use 28 bits.
Returns a Long representing the 64bit integer that comes by concatenating the given low, middle and high bits. Each is assumed to use 28 bits.
</div>


Expand Down Expand Up @@ -995,8 +978,7 @@ <h4 class="name" id="fromBits"><span class="type-signature">&lt;static> </span>f


<div class="description">
Returns a Long representing the 64bit integer that comes by concatenating the given low and high bits. Each is
assumed to use 32 bits.
Returns a Long representing the 64bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits.
</div>


Expand Down Expand Up @@ -1359,8 +1341,7 @@ <h4 class="name" id="fromNumber"><span class="type-signature">&lt;static> </span


<div class="description">
Returns a Long representing the given value, provided that it is a finite
number. Otherwise, zero is returned.
Returns a Long representing the given value, provided that it is a finitenumber. Otherwise, zero is returned.
</div>


Expand Down Expand Up @@ -1527,8 +1508,7 @@ <h4 class="name" id="fromString"><span class="type-signature">&lt;static> </span


<div class="description">
Returns a Long representation of the given string, written using the given
radix.
Returns a Long representation of the given string, written using the givenradix.
</div>


Expand Down Expand Up @@ -2156,8 +2136,7 @@ <h5>Returns:</h5>


<div class="param-desc">
0 if they are the same, 1 if the this is greater, and -1
if the given one is greater.
0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.
</div>


Expand Down Expand Up @@ -2789,8 +2768,7 @@ <h5>Returns:</h5>


<div class="param-desc">
Returns the number of bits needed to represent the absolute
value of this Long.
Returns the number of bits needed to represent the absolute value of this Long.
</div>


Expand Down Expand Up @@ -4539,8 +4517,7 @@ <h4 class="name" id="shiftRightUnsigned"><span class="type-signature"></span>shi


<div class="description">
Returns this Long with bits shifted to the right by the given amount, with
the new top bits matching the current sign bit.
Returns this Long with bits shifted to the right by the given amount, withthe new top bits matching the current sign bit.
</div>


Expand Down Expand Up @@ -4635,8 +4612,7 @@ <h5>Returns:</h5>


<div class="param-desc">
This shifted to the right by the given amount, with
zeros placed into the new leading bits.
This shifted to the right by the given amount, with zeros placed into the new leading bits.
</div>


Expand Down
6 changes: 6 additions & 0 deletions tests/suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ var suite = {
var longVal = Long.MAX_UNSIGNED_VALUE.div(Long.fromInt(-2));
test.equal(longVal.toNumber(), -Long.MAX_SIGNED_VALUE);
test.done();
},

"min_signed_div_one": function(test) {
var longVal = Long.MIN_SIGNED_VALUE.div(Long.ONE);
test.equal(longVal.toNumber(), Long.MIN_VALUE);
test.done();
}
},

Expand Down

0 comments on commit 1c2e981

Please sign in to comment.