Go语言的bit clear操作
以下摘自The Go Programming Language: The &^ operator is bit clear (AND NOT): in the expression z = x &^ y, each bit of z is 0 if the corresponding bit of y is 1; otherwise it equals the corresponding bit of x. 即z = x &^ y运算相当于先把y取反(针对y的每个bit:0变成1,1变成0),然后再和x进行&运算。参考下例: package main import "fmt" func main(){ var x uint8 = 1 var y uint8 = 1 << 2 fmt.Prin...阅读全文