Comparing version 4.5.2 to 4.6.0
{ | ||
"name": "bn.js", | ||
"version": "4.5.2", | ||
"version": "4.6.0", | ||
"description": "Big number implementation in pure javascript", | ||
@@ -5,0 +5,0 @@ "main": "lib/bn.js", |
@@ -97,2 +97,3 @@ # <img src="./logo.png" alt="bn.js" width="160" height="160" /> | ||
* `a.bincn(b)` - add `1 << b` to the number | ||
* `a.notn(w)` - not (for the width specified by `w`) (`i`) | ||
@@ -99,0 +100,0 @@ ### Reduction |
@@ -200,2 +200,26 @@ var assert = require('assert'); | ||
}); | ||
describe('.notn()', function() { | ||
it('should allow bitwise negation', function () { | ||
assert.equal(new BN('111000111', 2).notn(9).toString(2), | ||
'111000'); | ||
assert.equal(new BN('000111000', 2).notn(9).toString(2), | ||
'111000111'); | ||
assert.equal(new BN('111000111', 2).notn(9).toString(2), | ||
'111000'); | ||
assert.equal(new BN('000111000', 2).notn(9).toString(2), | ||
'111000111'); | ||
assert.equal(new BN('111000111', 2).notn(32).toString(2), | ||
'11111111111111111111111000111000'); | ||
assert.equal(new BN('000111000', 2).notn(32).toString(2), | ||
'11111111111111111111111111000111'); | ||
assert.equal(new BN('111000111', 2).notn(68).toString(2), | ||
'11111111111111111111111111111111' + | ||
'111111111111111111111111111000111000'); | ||
assert.equal(new BN('000111000', 2).notn(68).toString(2), | ||
'11111111111111111111111111111111' + | ||
'111111111111111111111111111111000111'); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
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
168464
4804
206