The two values involved in the calculation. If the two corresponding bits are the same, the result is 0. Otherwise, the result is 1. That is:
0 ^ 0 = 0, 1 ^ 0 = 1, 0 ^ 1 = 1, 1 ^ 1 = 0
Example: 10100001 ^ 00010001 = 10110000
0 ^ 0 = 0 0 ^ 1 = 1 0 variance or any number = any number
1 ^ 0 = ^ 1 = 0 1 variance or any number-returns the inverse of any number
Set yourself to 0 for any number difference or yourself =
(1) bitwise exclusive or can be used to flip certain specific bits. For example, if the number is 10100001 or 2nd bits, bitwise exclusive or operation can be performed on the number and 3rd bits.
10100001 ^ 00000110 = 10100111 // 1010 0001 ^ 0x06 = 1010 0001 ^ 6
(2) bitwise exclusive or operation can exchange two values without using temporary variables. For example, you can use the following statement to exchange the values of two integers, A and B:
A = 10100001, B = 00000110
A = a ^ B; // A = 10100111
B = B ^ A; // B = 10100001
A = a ^ B; // A = 00000110
(3) In assembly languages, variables are often set to zero:
XOR a,