作者热门文章
- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
<分区>
谁能帮帮我?请将 uint64 转换为 int64
//fmt.Println(int64(18446744073709551615))
//constant 18446744073709551615 overflows int64
var x uint64 = 18446744073709551615
var y int64 = int64(x)
fmt.Println(y) //-1
//just like(c)signed long long
//anyone can help me pls!
//How can I using like this?
// -9223372036854775808 +9223372036854775807
func BytesToInt(b []byte) int {
bytesBuffer := bytes.NewBuffer(b)
var tmp int32
binary.Read(bytesBuffer, binary.BigEndian, &tmp)
return int(tmp)
}
我是一名优秀的程序员,十分优秀!