2019.9.02 bitwise OR, bitwise AND, bitwise exclusive or

  1. ! a = b -----> a = a | b, a or b as long as there is a  1, then, a final result is  1  
  2. > a both a & = b ----- = a & b, a and b must both be  1, then, only for the final result A  1  
  3. a ^ = b -----> a = a ^ b, if and only if the disparity values of a and b, a final result is only 1, otherwise
Calculating, first translated into a binary number
such as:. 5: 0101
. 3: 0011
. 5 &. 3: 0001 =. 1
. 5 |. 3: 0111. 7 =
. 5. 3 ^: = 0110. 6
 
  1. ! a = b -----> a = a | b, a or b as long as there is a  1, then, a final result is  1  
  2. > a both a & = b ----- = a & b, a and b must both be  1, then, only for the final result A  1  
  3. a ^ = b -----> a = a ^ b, if and only if the disparity values of a and b, a final result is only 1, otherwise

Guess you like

Origin www.cnblogs.com/LiTZen/p/11444888.html