Skip to content

Commit 83ebd2b

Browse files
author
hero
committed
int64(占用了第一位)与uint64
1 parent a8d4b99 commit 83ebd2b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tool/binary_conversion/binary.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ func main() {
66
var switchs uint64
77
fmt.Printf("%064b\n", switchs)
88
//0000000000000000000000000000000000000000000000000000000000000000
9-
switchs = 1<<63 | 1<<62 | 1<<61 //赋值
9+
switchs = 1<<63 | 1<<2 | 1<<3 //赋值
1010
fmt.Printf("%064b\n", switchs)
1111
//1110000000000000000000000000000000000000000000000000000000000000
12-
switchs = 1<<63 | 0<<62 | 1<<61
12+
switchs = 1<<4 | 1<<5 | 1<<6
1313

1414
fmt.Printf("%064b\n", switchs)
1515
//1010000000000000000000000000000000000000000000000000000000000000
1616

17-
fmt.Println(1 << 62 & switchs) //判断第二位是不是0
17+
fmt.Println(1 << 4 & switchs) //判断第二位是不是0
1818
//0
1919
}

0 commit comments

Comments
 (0)