&^ 按位清零
package operatortest
import "testing"
func TestCompareArray(t *testing.T) {
a := [...]int{1, 2, 3, 4}
b := [...]int{1, 3, 4, 5}
// c := [...]int{1, 2, 3, 4, 5}
d := [...]int{1, 2, 3, 4}
t.Log(a == b)
//t.Log(a == c)
t.Log(a == d)
}
// 位运算
const (
Read = 1 << iota
Write
Excute
)
func TestBi8tClear(t *testing.T) {
a := 7
a = a &^ Read
a = a &^ Excute
t.Log(a&Read == Read, a&Write == Write, a&Excute == Excute)
}