mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-11 23:52:31 +08:00
Merge pull request #19 from miraclesu/4.5bit
fixed Bit operators clerical error
This commit is contained in:
@@ -240,19 +240,19 @@ Go 拥有以下复数类型:
|
||||
|
||||
对应位置上的值经过或运算结果,具体参见或运算符,第 4.5.1 节,并将 T(true)替换为 1,将 F(false)替换为 0
|
||||
|
||||
1 & 1 -> 1
|
||||
1 & 0 -> 1
|
||||
0 & 1 -> 1
|
||||
0 & 0 -> 0
|
||||
1 | 1 -> 1
|
||||
1 | 0 -> 1
|
||||
0 | 1 -> 1
|
||||
0 | 0 -> 0
|
||||
|
||||
- 按位异或 `^`:
|
||||
|
||||
对应位置上的值根据以下规则组合:
|
||||
|
||||
1 & 1 -> 0
|
||||
1 & 0 -> 1
|
||||
0 & 1 -> 1
|
||||
0 & 0 -> 0
|
||||
1 ^ 1 -> 0
|
||||
1 ^ 0 -> 1
|
||||
0 ^ 1 -> 1
|
||||
0 ^ 0 -> 0
|
||||
|
||||
- 位清除 `&^`:将指定位置上的值设置为 0。
|
||||
|
||||
@@ -465,4 +465,4 @@ Example 4.12 [char.go](examples/chapter_4/char.go)
|
||||
##链接
|
||||
- [目录](directory.md)
|
||||
- 上一节:[变量](04.4.md)
|
||||
- 下一节:[字符串](04.6.md)
|
||||
- 下一节:[字符串](04.6.md)
|
||||
|
Reference in New Issue
Block a user