You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
setRange sets the wrong bits when the range crosses a 32-bit word (regression in 5.3.0) #51
Since 5.3.0, setRange(from, to, value) sets only part of the range whenever it spans more than one 32-bit word. 5.2.3 handles the same calls correctly.
Reproduction (Node 26.13.1, bitset 5.3.0):
constBitSet=require('bitset');constb=newBitSet();b.setRange(0,63,1);console.log(b.cardinality());// 5.3.0: 32 5.2.3: 64console.log(b.toString(2));// 5.3.0: only bits 0–31 are set
Comparing setRange against setting the same bits one at a time:
Ranges that stay inside one word are correct (setRange(10, 20, 1) gives 11 bits); ranges that cross a word boundary lose bits, e.g. setRange(1, 127, 1) gives 95 instead of 127.
Expected: every bit from from to to inclusive is set, as in 5.2.3 and as the README describes.
Activity