I l@ve RuBoard Previous Section Next Section

11.5 The Ones Complement Operator (NOT) (~)

The NOT operator (also called the invert operator or bit flip) is a unary operator that returns the inverse of its operand, as shown in Table 11-6.

Table 11-6. NOT operator

Bit

~Bit

0

1

1

0

Here's an example of NOT performed on a byte:

c=      0x45      01000101
________________________________
~c=     0xBA      10111010
    I l@ve RuBoard Previous Section Next Section