I would like to encode some information in Code128 barcodes which allow 96 different characters to be used in one slot. Therefore, 95
decimal would translate to 101 1111b
and 96
to 1 000 0000b
.
Now I need an algorithm that converts a decimal (or binary) number into 7 bit words with 96 states at maximum. I sat here all morning trying to figure that algorithm out (playing with bit shifts and logarithms), but it seems that I'm missing some important point here.
How would I translate, for example, 537
(10 0001 1001b
) into such words?