-
The corrected code (to get a slice of bits from a byte) is: const mask = 2 ** length - 1; const shift = 8 - (ptr + length); return (value & (mask << shift)) >> shift;
-
Okay, this function is actually incorrect. It works at times, but not others. Darnit.