I read about this. I'm not sure I can understand the logic of the test but this has nothing to do with my question.
please read my replay again. I meant exactly the opposite of what you think.
What I meant is that the logic of the test has nothing to do with my question. Off course that the answer of jsmith was relevant to my question as this is the test that is being done.
Sorry if I have offended you or jsmith in ANY way.
n & 255u
255 in binary is 11111111 (eight 1s)
u means to treat the value as unsigned (int). On a 32-bit platform, this results in the binary value:
00000000 00000000 00000000 11111111
From boolean math, we know that x & 0 == 0, and x & 1 == x.
Therefore the result of the operation ( n & 255u ) is just the lower 8 bits of n.
So if( ( n & 255u ) < 32u )
says essentially to compare the lower 8-bits of n to 32.
What I still don't understand is why the two tests are equivalent?
There is a good chance that the two are not and they are simply brought as an example.
Great so all I got to do is read this paragraph again.