Skip to content

Commit 1c2e981

Browse files
committed
Post-merge
2 parents 2b19314 + 2484cb6 commit 1c2e981

4 files changed

Lines changed: 31 additions & 47 deletions

File tree

Long.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@
706706
}
707707
if (this.equals(Long.MIN_SIGNED_VALUE)) {
708708
if (other.equals(Long.ONE) || other.equals(Long.NEG_ONE)) {
709-
return min; // recall that -MIN_VALUE == MIN_VALUE
709+
return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
710710
} else if (other.equals(Long.MIN_VALUE)) {
711711
return Long.ONE;
712712
} else {

Long.min.js

Lines changed: 15 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/Long.html

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,7 @@ <h4 class="name" id="Long"><span class="type-signature"></span>new Long<span cla
4949

5050

5151
<div class="description">
52-
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.
6953
</div>
7054

7155

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

774758

775759
<div class="description">
776-
Returns a Long representing the 64bit integer that comes by concatenating the given low, middle and high bits.
777-
Each is assumed to use 28 bits.
760+
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.
778761
</div>
779762

780763

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

996979

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

1002984

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

13601342

13611343
<div class="description">
1362-
Returns a Long representing the given value, provided that it is a finite
1363-
number. Otherwise, zero is returned.
1344+
Returns a Long representing the given value, provided that it is a finitenumber. Otherwise, zero is returned.
13641345
</div>
13651346

13661347

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

15281509

15291510
<div class="description">
1530-
Returns a Long representation of the given string, written using the given
1531-
radix.
1511+
Returns a Long representation of the given string, written using the givenradix.
15321512
</div>
15331513

15341514

@@ -2156,8 +2136,7 @@ <h5>Returns:</h5>
21562136

21572137

21582138
<div class="param-desc">
2159-
0 if they are the same, 1 if the this is greater, and -1
2160-
if the given one is greater.
2139+
0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.
21612140
</div>
21622141

21632142

@@ -2789,8 +2768,7 @@ <h5>Returns:</h5>
27892768

27902769

27912770
<div class="param-desc">
2792-
Returns the number of bits needed to represent the absolute
2793-
value of this Long.
2771+
Returns the number of bits needed to represent the absolute value of this Long.
27942772
</div>
27952773

27962774

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

45404518

45414519
<div class="description">
4542-
Returns this Long with bits shifted to the right by the given amount, with
4543-
the new top bits matching the current sign bit.
4520+
Returns this Long with bits shifted to the right by the given amount, withthe new top bits matching the current sign bit.
45444521
</div>
45454522

45464523

@@ -4635,8 +4612,7 @@ <h5>Returns:</h5>
46354612

46364613

46374614
<div class="param-desc">
4638-
This shifted to the right by the given amount, with
4639-
zeros placed into the new leading bits.
4615+
This shifted to the right by the given amount, with zeros placed into the new leading bits.
46404616
</div>
46414617

46424618

tests/suite.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ var suite = {
127127
var longVal = Long.MAX_UNSIGNED_VALUE.div(Long.fromInt(-2));
128128
test.equal(longVal.toNumber(), -Long.MAX_SIGNED_VALUE);
129129
test.done();
130+
},
131+
132+
"min_signed_div_one": function(test) {
133+
var longVal = Long.MIN_SIGNED_VALUE.div(Long.ONE);
134+
test.equal(longVal.toNumber(), Long.MIN_VALUE);
135+
test.done();
130136
}
131137
},
132138

0 commit comments

Comments
 (0)