What is the meaning of the & ^ operator?

I am new to golang and confused by the & & operator.

From spec explanation "& ^": clear (AND NOT) bit. In my understanding, this means: x & ^ y == x and (^ y).

As far as I understand? Thanks!

+4
source share
1 answer

Your understanding is correct. You can do this as a "bit operator", and the rules are:

1 &^ 1 = 0
1 &^ 0 = 1
0 &^ 0 = 0
0 &^ 1 = 0

As well as x & y, x ^ y, x | y.

+6
source

All Articles