Using \"ordinary C\", I wish to compare two 8 bit bytes to determine if the second is the bitwise complement of the first. For example if Byte1 is binary 00001111 (15 in de
The ~ operator causes its operands to be promoted to int before being complemented. ~15 is not 240 but some other value, depending on the size of int.
Just use if (X + Y == 255) and it should work.
if (X + Y == 255)