Ech, is that right? I don't understand `wordSizeShift`.
I have always done bitset tests as follows:
this.set = function(bit, value) {
const index = Math.floor(bit / BitsPerElement);
const offset = bit - (index * BitsPerElement);
var element = this.buffer[index];
if (value)
element |= (1 << offset);
else
element &= ~(1 << offset);
this.buffer[index] = element;
}
this.get = function(bit) {
const index = Math.floor(bit / BitsPerElement);
const offset = bit - (index * BitsPerElement);
const element = this.buffer[index];
return (element & (1 << offset));
}