Comparing version 0.9.23 to 0.9.24
{ | ||
"name": "bufrw", | ||
"version": "0.9.23", | ||
"version": "0.9.24", | ||
"description": "Buffer Reading and Writing", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
@@ -106,2 +106,3 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
['', [0x00]], | ||
['/', [0x01, 0x2f]], | ||
['abc', [0x03, 0x61, 0x62, 0x63]], | ||
@@ -108,0 +109,0 @@ [bigTestStr, bigTestBytes], |
@@ -42,5 +42,4 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
if (n === 0) LengthResult.just(1); | ||
var nbits = 1; | ||
if (n > 0) nbits = Math.log(n) / Math.log(2); | ||
var needed = Math.ceil(nbits / 7); | ||
var needed = Math.ceil(countBits(n) / 7); | ||
return LengthResult.just(needed); | ||
@@ -55,5 +54,3 @@ } | ||
var nbits = 1; | ||
if (n > 0) nbits = Math.log(n) / Math.log(2); | ||
var needed = Math.ceil(nbits / 7); | ||
var needed = Math.ceil(countBits(n) / 7); | ||
var start = offset; | ||
@@ -73,3 +70,4 @@ var end = offset + needed; | ||
buffer.writeUInt8(b, --offset, true); | ||
} while (n > 0); | ||
if (n <= 0) break; | ||
} | ||
@@ -93,1 +91,7 @@ return WriteResult.just(end); | ||
} | ||
function countBits(n) { | ||
var res = 1; | ||
while (n >>= 1) res++; | ||
return res; | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
171004
54
4280
1