previous | start | next

Bitwise xor



unsigned char x = 0x1C;
unsigned char y = 0x95;
In binary x's value:  00011100
          y's value:  10010101
          ---------- ---------
          x ^ y    :  10001001

In hex x's value: 0x1C
       y's value: 0x95
       ---------  --
       x ^ y      0x89

(In decimal, x ^ y = 137.)

The | operation is performed on each bit position k of its operands to
produce the bit value in the k-th position of the result. The result
bit is determined by the table

               right bit
               0   1
              ------
   left bit 0| 0   1
            1| 1   0



previous | start | next