Comparing version 0.4.2 to 0.4.3
@@ -159,2 +159,3 @@ function assert(val, msg) { | ||
/* | ||
function _zero(n) { | ||
@@ -175,3 +176,31 @@ var code = ''; | ||
var zero14 = _zero(14); | ||
*/ | ||
// Sadly chrome apps could not contain `new Function()` calls | ||
function zero6(w) { | ||
if (w.length === 5) return '0' + w; | ||
if (w.length === 4) return '00' + w; | ||
if (w.length === 3) return '000' + w; | ||
if (w.length === 2) return '0000' + w; | ||
if (w.length === 1) return '00000' + w; | ||
return w; | ||
} | ||
function zero14(w) { | ||
if (w.length === 13) return '0' + w; | ||
if (w.length === 12) return '00' + w; | ||
if (w.length === 11) return '000' + w; | ||
if (w.length === 10) return '0000' + w; | ||
if (w.length === 9) return '00000' + w; | ||
if (w.length === 8) return '000000' + w; | ||
if (w.length === 7) return '0000000' + w; | ||
if (w.length === 6) return '00000000' + w; | ||
if (w.length === 5) return '000000000' + w; | ||
if (w.length === 4) return '0000000000' + w; | ||
if (w.length === 3) return '00000000000' + w; | ||
if (w.length === 2) return '000000000000' + w; | ||
if (w.length === 1) return '0000000000000' + w; | ||
return w; | ||
} | ||
// Precomputed divisor for `.toString(10)` = 10 ^ 14 | ||
@@ -241,2 +270,3 @@ var div10 = new BN(null); | ||
/* | ||
function genCountBits(bits) { | ||
@@ -254,3 +284,33 @@ var arr = []; | ||
BN.prototype._countBits = genCountBits(24); | ||
*/ | ||
// Sadly chrome apps could not contain `new Function()` calls | ||
BN.prototype._countBits = function _countBits(w) { | ||
return w >= 0x800000 ? 24: | ||
w >= 0x400000 ? 23: | ||
w >= 0x200000 ? 22: | ||
w >= 0x100000 ? 21: | ||
w >= 0x80000 ? 20: | ||
w >= 0x40000 ? 19: | ||
w >= 0x20000 ? 18: | ||
w >= 0x10000 ? 17: | ||
w >= 0x8000 ? 16: | ||
w >= 0x4000 ? 15: | ||
w >= 0x2000 ? 14: | ||
w >= 0x1000 ? 13: | ||
w >= 0x800 ? 12: | ||
w >= 0x400 ? 11: | ||
w >= 0x200 ? 10: | ||
w >= 0x100 ? 9: | ||
w >= 0x80 ? 8: | ||
w >= 0x40 ? 7: | ||
w >= 0x20 ? 6: | ||
w >= 0x10 ? 5: | ||
w >= 0x8 ? 4: | ||
w >= 0x4 ? 3: | ||
w >= 0x2 ? 2: | ||
w >= 0x1 ? 1: | ||
0; | ||
} | ||
// Return number of used bits in a BN | ||
@@ -257,0 +317,0 @@ BN.prototype.bitLength = function bitLength() { |
{ | ||
"name": "bn.js", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "Big number implementation in pure javascript", | ||
@@ -5,0 +5,0 @@ "main": "lib/bn.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36794
1199