Ultimately, this code checks to see if one bit is enabled (FCTRL flag) in the variable uop->flags
.
But here is the explanation:
Implicitly, the if(X)
code verifies that the value of X is "true." For integers, 0 is the only "false" value, and everything else is "true."
Therefore your code is equivalent:
if (0 != (uop->flags & FCTRL))
Now what does that mean?
The &
operator performs a bitwise AND, which means that each bit on the left side of AND has a corresponding bit on the right side.
So, if we wrote out our two operands in binary format:
uop->flags 1010 1010 (example) FCTRL 0100 0000
In this example, if you execute "AND" for each pair of bits, you get the result:
result 0000 0000
Which evaluates to false, and indeed in this example, the value uop->flags
does not have the FCTRL flag set.
Now here is another example where the flag is set :
uop->flags 1110 1010 (example) FCTRL 0100 0000
Corresponding ANDed result:
result 0100 0000
This result is nonzero, so "true" by calling the if
.
source share