I wanted to know if anyone knows what would be faster and why.
do:
this.data[byte] |= 1 << bitIndex;
Or do1:
const BIT_MASKS: Uint8Array = new Uint8Array([1, 2, 4, 8, 16, 32, 64, 128]);
this.data[byte] |= BIT_MASKS[bitIndex];
I wanted to know if anyone knows what would be faster and why.
do:
this.data[byte] |= 1 << bitIndex;
Or do1:
const BIT_MASKS: Uint8Array = new Uint8Array([1, 2, 4, 8, 16, 32, 64, 128]);
this.data[byte] |= BIT_MASKS[bitIndex];