bit manipulation in C
Posted on 2006-06-15
I have a data structure to represent 1024 bits
unsigned long myarray ;
How do I efficiently iterate through it to find which bits are set.
Any of the bit manipulation macros such as "test_bit" are sequential and hence makes it an o(n) operation.
Is there something I can do like setting a mask every time a bit gets set and then use that mask to find
out later all the set bits.