bn.js 4.12.2 → 4.12.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
|
@@ -828,6 +828,12 @@
|
|
|
828
828
|
// Handle the residue
|
|
829
829
|
if (bitsLeft > 0) {
|
|
830
830
|
this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));
|
|
831
|
+
i++;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
// Clear words above the requested width so the result stays below 2 ** width
|
|
835
|
+
for (; i < this.length; i++) {
|
|
836
|
+
this.words[i] = 0;
|
|
831
837
|
}
|
|
832
838
|
|
|
833
839
|
// And remove leading zeroes
|
|
@@ -2129,6 +2135,11 @@
|
|
|
2129
2135
|
this.words[this.length - 1] &= mask;
|
|
2130
2136
|
}
|
|
2131
2137
|
|
|
2138
|
+
if (this.length === 0) {
|
|
2139
|
+
this.words[0] = 0;
|
|
2140
|
+
this.length = 1;
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2132
2143
|
return this.strip();
|
|
2133
2144
|
};
|
|
2134
2145
|
|