对golang中的位清除(&^)很模糊,它实际上就是先异或后与,但是我实在不清楚位清除有哪些作用?
a := 6 //0110
b := 11 //1011 => ^b == 0100 => 0100^0110 == 0100 == 4
a &^ b == 4
a & ^b == 4
对golang中的位清除(&^)很模糊,它实际上就是先异或后与,但是我实在不清楚位清除有哪些作用?
a := 6 //0110
b := 11 //1011 => ^b == 0100 => 0100^0110 == 0100 == 4
a &^ b == 4
a & ^b == 4