Overview#
Bitwise XOR (Exclusive OR) is a Bitwise operation which is used in bit manipulation and on BitmasksBitwise 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 examplesIf 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
Decimal | Binary | |
---|---|---|
10270010 | 100111001011010100111010 | Bitwise XOR |
5905368 | 010110100001101111011000 | Equals |
13020898 | 110001101010111011100010 | Result |