bn.js 5.2.2 → 5.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bn.js +11 -0
- package/package.json +1 -1
package/lib/bn.js
CHANGED
|
@@ -910,6 +910,12 @@
|
|
|
910
910
|
// Handle the residue
|
|
911
911
|
if (bitsLeft > 0) {
|
|
912
912
|
this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));
|
|
913
|
+
i++;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
// Clear words above the requested width so the result stays below 2 ** width
|
|
917
|
+
for (; i < this.length; i++) {
|
|
918
|
+
this.words[i] = 0;
|
|
913
919
|
}
|
|
914
920
|
|
|
915
921
|
// And remove leading zeroes
|
|
@@ -2216,6 +2222,11 @@
|
|
|
2216
2222
|
this.words[this.length - 1] &= mask;
|
|
2217
2223
|
}
|
|
2218
2224
|
|
|
2225
|
+
if (this.length === 0) {
|
|
2226
|
+
this.words[0] = 0;
|
|
2227
|
+
this.length = 1;
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2219
2230
|
return this._strip();
|
|
2220
2231
|
};
|
|
2221
2232
|
|