Skip to content

Commit f71f9fc

Browse files
committed
Actually test if msb is one, see dcodeIO#15
1 parent 282785d commit f71f9fc

File tree

8 files changed

+9
-8
lines changed

8 files changed

+9
-8
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "long",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
44
"author": "Daniel Wirtz <dcode@dcode.io>",
55
"description": "A Long class for representing a 64 bit two's-complement integer value.",
66
"main": "dist/Long.js",

dist/Long.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@
509509
Long.prototype.equals = function(other) {
510510
if (!Long.isLong(other))
511511
other = Long.fromValue(other);
512-
if (this.unsigned !== other.unsigned && (this.high >>> 31) === (other.high >>> 31))
512+
if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
513513
return false;
514514
return this.high === other.high && this.low === other.low;
515515
};

dist/Long.min.js

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

dist/Long.min.js.gz

2 Bytes
Binary file not shown.

dist/Long.min.map

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "long",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
44
"author": "Daniel Wirtz <dcode@dcode.io>",
55
"description": "A Long class for representing a 64-bit two's-complement integer value.",
66
"main": "index.js",

src/Long.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@
509509
Long.prototype.equals = function(other) {
510510
if (!Long.isLong(other))
511511
other = Long.fromValue(other);
512-
if (this.unsigned !== other.unsigned && (this.high >>> 31) === (other.high >>> 31))
512+
if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
513513
return false;
514514
return this.high === other.high && this.low === other.low;
515515
};

tests/suite.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ var suite = {
147147
var longVal = Long.UONE.shiftLeft(63);
148148
test.ok(longVal.notEquals(Long.MIN_VALUE));
149149
test.equal(longVal.toString(), "9223372036854775808");
150+
test.equal(Long.fromString("9223372036854775808", true).toString(), "9223372036854775808");
150151
test.done();
151152
}
152153
}

0 commit comments

Comments
 (0)