I am trying to eliminate an IF statement whereby if I receive the number 32 I would like a '1', but any other number I would like a '0'.
32 is 0010 0000 so I thought about XOR-ing my input number with 1101 1111. Therefore if I get the number 32 I end up with 1111 1111.
Now is there any way of AND-ing the individual bits (1111 1111), because if one of my XOR results is a 0, it means my final AND-ed value is 0, otherwise its a 1?
EDIT: Using GCC, not Intel compiler (because I know there are a lot of intrinsic functions there)
ifstatement, the compiler could optimize it away, the only way to tell is to look at the generated assembly.(x & 32) && !(x & ~32)