Hello!
I have never encountered this problem, but here is a method that could be somewhat faster than
doing it bit by bit.
- Make a table of 256 bytes with the transition numberers:
0 -> 0
1 -> 1
2 -> 2
3 -> 1
4 -> 2
5 -> 3
Etc...
Now you can process byte by byte instead of processing bit by bit.
You have to be careful in a series of bytes about the LSB of the left part and MSB of the right one.
If they are different, then you have one extra transition to add to the new byte.
Of cours, you should try it in oder to determine what you gain (how fast) and what you loose
(256 bytes of memory), but I would bet it's faster.
Dora.