You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func main() {
var a int64 = 178438932798732984
var b int64 = 318793718938921712
fmt.Printf("a value %064b\n", a)
fmt.Printf("b value %064b\n", b)
aor := a | b
aadd := a + b
fmt.Printf("a|b value %064b\n", aor)
fmt.Printf("a+b value %064b\n", aadd)
fmt.Printf("| %d\n ", aor)
fmt.Printf("add %d\n ", aadd)
if aor != aadd {
fmt.Println("not equal")
}
}
看到的源码是这样写的,使用加法返回拼接的位数
做了简单的测试代码,发现加和或的值不一样
另外发现,go做左移的时候会有溢出的问题
The text was updated successfully, but these errors were encountered: