Skip to content

Commit 7a2a95a

Browse files
committedDec 19, 2018
Fixed #31
1 parent 6756baa commit 7a2a95a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed
 

‎bitset.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@
244244
var d = this['data'];
245245
var n = ndx >>> WORD_LOG;
246246

247-
if (n > d.length) {
247+
if (n >= d.length) {
248248
return this['_'] & 1;
249249
}
250250
return (d[n] >>> ndx) & 1;

‎tests/bitset.test.js

+8
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,14 @@ describe('BitSet', function() {
737737
assert.deepEqual(x.toArray(), [4, 8, 32, 65]);
738738
});
739739

740+
it('get higher bits correctly', function() {
741+
742+
var a = new BitSet([34]).not();
743+
var b = new BitSet().set(34, 1).not();
744+
745+
assert.equal(a.get(80), b.get(80));
746+
});
747+
740748
it('should withstand some fuzz', function() {
741749

742750
for (var i = 0; i < 100; i++) {

0 commit comments

Comments
 (0)
Failed to load comments.