Go 中 int 类型的最大值

Go 中 int 类型的最大值,第1张

Go 中 int 类型最大值

相关的部分:

由于整数类型使用二进制补码运算,可以推断最小/最大常数值

int
uint
。例如,

golangconst MaxUint = ^uint(0) const MinUint = 0 const MaxInt = int(MaxUint >> 1) const MinInt = -MaxInt - 1

根据@CarelZA 的评论:

uint8  : 0 to 255 uint16 : 0 to 65535 uint32 : 0 to 4294967295 uint64 : 0 to 18446744073709551615 int8   : -128 to 127 int16  : -32768 to 32767 int32  : -2147483648 to 2147483647 int64  : -9223372036854775808 to 9223372036854775807


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5629888.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-16
下一篇2022-12-15

发表评论

登录后才能评论

评论列表(0条)

    保存