Generate number sequences using bit operations
Hi,
I often find myself needing to produce simple number sequences that often do not exceed 4 numbers, for example
0 1 1 0 or 1 0 -1 0 or 1 1 -1 -1 or 1 -1 0 0
I'm wondering if there is some way to generate a formula of bit operations quickly by providing the desired sequence? (It often comes down to a little bit shifting, ANDs, and XORs.)
Just wondering if anyone else might have encountered this (and maybe has a solution to it). I always sit down then and cook up some formula thinking someone else must have done that before.
Thanks,
crisc