I have a 32 bit unsigned int and I have to check the lowest set bit in that. I can check linearly i.e. staring from lowest bit to highest, but I was wondering whether there is any better way.
Why do not we adopt a binary search kind of option? Mask the lower half of the bit pattern with a mask like 0XFF if it is non-zero then do binary search repeatedly else look at the other half.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment