Bit twiddling implementation finished, all bitstream tests pass now.