b := make([]byte, 1) b[0] = 255 fmt.Printf("%b\n", b[0]) //11111111 fmt.Printf("%b\n", b[0]>>7)//1
fmt.Printf("%b\n", (b[0]>>6) & 1)// = 11 & 01 = 1
b := make([]byte, 1) b[0] = 255 fmt.Printf("%b\n", b[0]) //11111111 fmt.Printf("%b\n", b[0]>>7)//1
fmt.Printf("%b\n", (b[0]>>6) & 1)// = 11 & 01 = 1
转载于:https://www.cnblogs.com/flytome/p/9640166.html