mirror of
https://github.com/golang/go
synced 2024-09-29 12:04:28 -06:00
math: show value of integer constants in comments
Fixes #51282 Change-Id: I5b0d68165b727a427bd4a42663b2fa0070ced22f Reviewed-on: https://go-review.googlesource.com/c/go/+/343990 Run-TryBot: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
334984a92a
commit
68370187fa
@ -39,19 +39,19 @@ const (
|
||||
const (
|
||||
intSize = 32 << (^uint(0) >> 63) // 32 or 64
|
||||
|
||||
MaxInt = 1<<(intSize-1) - 1
|
||||
MinInt = -1 << (intSize - 1)
|
||||
MaxInt8 = 1<<7 - 1
|
||||
MinInt8 = -1 << 7
|
||||
MaxInt16 = 1<<15 - 1
|
||||
MinInt16 = -1 << 15
|
||||
MaxInt32 = 1<<31 - 1
|
||||
MinInt32 = -1 << 31
|
||||
MaxInt64 = 1<<63 - 1
|
||||
MinInt64 = -1 << 63
|
||||
MaxUint = 1<<intSize - 1
|
||||
MaxUint8 = 1<<8 - 1
|
||||
MaxUint16 = 1<<16 - 1
|
||||
MaxUint32 = 1<<32 - 1
|
||||
MaxUint64 = 1<<64 - 1
|
||||
MaxInt = 1<<(intSize-1) - 1 // MaxInt32 or MaxInt64 depending on intSize.
|
||||
MinInt = -1 << (intSize - 1) // MinInt32 or MinInt64 depending on intSize.
|
||||
MaxInt8 = 1<<7 - 1 // 127
|
||||
MinInt8 = -1 << 7 // -128
|
||||
MaxInt16 = 1<<15 - 1 // 32767
|
||||
MinInt16 = -1 << 15 // -32768
|
||||
MaxInt32 = 1<<31 - 1 // 2147483647
|
||||
MinInt32 = -1 << 31 // -2147483648
|
||||
MaxInt64 = 1<<63 - 1 // 9223372036854775807
|
||||
MinInt64 = -1 << 63 // -9223372036854775808
|
||||
MaxUint = 1<<intSize - 1 // MaxUint32 or MaxUint64 depending on intSize.
|
||||
MaxUint8 = 1<<8 - 1 // 255
|
||||
MaxUint16 = 1<<16 - 1 // 65535
|
||||
MaxUint32 = 1<<32 - 1 // 4294967295
|
||||
MaxUint64 = 1<<64 - 1 // 18446744073709551615
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user