I currently use these two functions to pack and read bits in a byte array. Wondering if anybody has any better ideas or faster ways to do it?
Edited the program with a
A totally different route would be to define static table of all possible combinations and perform a lookup instead of calculating results each time. I think thats how they do it in cryptography. array[i] x 3 should be much faster than numBits bitwise operations. It will occupy some heap though.