11.4 The Bitwise Exclusive OR ()

I l @ ve RuBoard

11.4 The Bitwise Exclusive OR (^)

The exclusive OR (also known as XOR) operator results in a 1 when either of its two operands is a 1, but not both. The truth table for the exclusive OR operator is listed in Table 11-5.

Table 11-5. Bitwise exclusive OR operator

Bit1

Bit2

Bit1 ^ Bit2

1

1

1

1

1

1

Here's an example of bitwise exclusive OR performed on a byte:

 i1=0x47       01000111  ^      i2=0x53       01010011 ______________________________          0x14        00010100 
I l @ ve RuBoard


Practical C++ Programming
Practical C Programming, 3rd Edition
ISBN: 1565923065
EAN: 2147483647
Year: 2003
Pages: 364

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net