AND with full bits?

bit-manipulation, c, c++

Solution

"somevar" could be a 64-bit variable, this code would therefore extract the bottom 32 bits.

edit: if it's a 32-bit variable, I can think of other reasons but they are much more obscure:

- the constant 0xFFFFFFFF was automatically generated code

- someone is trying to trick the compiler into preventing something from being optimized

- someone intentionally wants a no-op line to be able to set a breakpoint there during debugging.

Problem

I have been reading over some code lately and came across some lines such as: ``` somevar &= 0xFFFFFFFF; ``` What is the point of anding something that has all bits turned on; doesn't it just equal somevar in the end?

Original source