Address review comments

Fixed encoding of 1024 bytes and multiples
Fixed decoding of those too.
Rewrote encode a bit, removing memset and working in groups of 8 encoded
bytes to try to optimize.
Added bit macros to clarify bit magic a bit
Removed debug print statements. Oops.