Two exchange number a ^ = b; b ^ = a; a ^ = b;

 Two exchange number a ^ = b; b ^ = a; a ^ = b;

= a ^ b is equivalent to a = a ^ b, where ^ is a bit XOR operation, i.e. a XORed with the corresponding bit of b, with the same is 0 or 1, the corresponding bit of the result is zero; otherwise 1. 
For example, it is assumed, 1010, b 1100 a binary value of the binary value, then A ^ B = 0110

 

Guess you like

Origin www.cnblogs.com/wn798/p/12012136.html
B