bitwise XOR
Bitwise XOR or bitwise exclusive OR is a bit-level operation on two binary values which indicates which bits are set in only one value. For each position , if the bit in one value is 1 and the other is 0, then of the result is 1, otherwise it’s 0. If both input are 1, the output is 0. then For example, given 50 and 163 in two unsigned bytes, a bitwise XOR returns 145.
0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | |
XOR | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 |
---|---|---|---|---|---|---|---|---|
= | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 |
Given a Mersenne number of the form (where is the bit size of the data type in use, e.g., 8 for bytes, 16 for words, 32 for double words, etc.) and some smaller integer , XORing that Mersenne number with has the same effect as performing a bitwise NOT on . Or, given and , XORing them has the same effect as (subject to some caveats about the sign bit, or if the values are unsigned, the effect is then the same as ). XORing two values that are the same gives 0.
Title | bitwise XOR |
---|---|
Canonical name | BitwiseXOR |
Date of creation | 2013-03-22 17:02:52 |
Last modified on | 2013-03-22 17:02:52 |
Owner | PrimeFan (13766) |
Last modified by | PrimeFan (13766) |
Numerical id | 4 |
Author | PrimeFan (13766) |
Entry type | Definition |
Classification | msc 11A63 |
Related topic | BitwiseAND |
Related topic | BitwiseOR |
Related topic | BitwiseNOT |