异或为相同为 0 相异为 1
例子
010101
^
001011
=
011110
规则
a ^ a = 0 ------>幂
a ^ b = b ^ a ------>交换
a ^ 0 = a ------>与0异或
a ^ b ^ c = a ^ (b ^ c) ------>结合
(a ^ b ^ c) ^ c = a ^ b ------>消去
交换两个数
a = a ^ b;
b = a ^ b;
a = a ^ b;
关于异或^
异或为相同为 0 相异为 1
010101
^
001011
=
011110
a ^ a = 0 ------>幂
a ^ b = b ^ a ------>交换
a ^ 0 = a ------>与0异或
a ^ b ^ c = a ^ (b ^ c) ------>结合
(a ^ b ^ c) ^ c = a ^ b ------>消去
a = a ^ b;
b = a ^ b;
a = a ^ b;