izard: (Default)
izard ([personal profile] izard) wrote2011-07-26 09:24 am
Entry tags:

Math q

It's been a while since I was not able to find an answer to a technical question in google. Usually I can find anything, the key is to know part of the answer.

Now my math skills are lagging.

I have a 32 bit unsigned number. I need to check if bit N (11 < N < 22) is set when a number is divided by 3. The trick is I don't want to do a division and would like to know if I can construct a bitmask for each N which checks the bit using only bit ops.

I have a hunch that a method exists, but not sure studying which area of math may help.

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting