jspωiki
Bitwise XOR

Overview#

Bitwise XOR (Exclusive OR) is a Bitwise operation which is used in bit manipulation and on Bitmasks

Bitwise XORtake two equal-length bit patterns.

  • outputs a 1 whenever the inputs do NOT match (False as any non-zero value is considered false)
  • outputs a 0 ONLY WHEN the inputs do match (True)

Bitwise XOR Examples#

So in these examples

If both bits in the compared position of the bit patterns are 0 or 1, the bit in the resulting bit pattern is 0, otherwise 1.

Another slightly more complex example

DecimalBinary
10270010100111001011010100111010Bitwise XOR
5905368010110100001101111011000Equals
13020898110001101010111011100010Result

More Information#

There might be more information for this subject on one of the following: