Skip to content

Commit 6837018

Browse files
shuLhangopherbot
authored andcommitted
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 <[email protected]> Auto-Submit: Robert Griesemer <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 334984a commit 6837018

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/math/const.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ const (
3939
const (
4040
intSize = 32 << (^uint(0) >> 63) // 32 or 64
4141

42-
MaxInt = 1<<(intSize-1) - 1
43-
MinInt = -1 << (intSize - 1)
44-
MaxInt8 = 1<<7 - 1
45-
MinInt8 = -1 << 7
46-
MaxInt16 = 1<<15 - 1
47-
MinInt16 = -1 << 15
48-
MaxInt32 = 1<<31 - 1
49-
MinInt32 = -1 << 31
50-
MaxInt64 = 1<<63 - 1
51-
MinInt64 = -1 << 63
52-
MaxUint = 1<<intSize - 1
53-
MaxUint8 = 1<<8 - 1
54-
MaxUint16 = 1<<16 - 1
55-
MaxUint32 = 1<<32 - 1
56-
MaxUint64 = 1<<64 - 1
42+
MaxInt = 1<<(intSize-1) - 1 // MaxInt32 or MaxInt64 depending on intSize.
43+
MinInt = -1 << (intSize - 1) // MinInt32 or MinInt64 depending on intSize.
44+
MaxInt8 = 1<<7 - 1 // 127
45+
MinInt8 = -1 << 7 // -128
46+
MaxInt16 = 1<<15 - 1 // 32767
47+
MinInt16 = -1 << 15 // -32768
48+
MaxInt32 = 1<<31 - 1 // 2147483647
49+
MinInt32 = -1 << 31 // -2147483648
50+
MaxInt64 = 1<<63 - 1 // 9223372036854775807
51+
MinInt64 = -1 << 63 // -9223372036854775808
52+
MaxUint = 1<<intSize - 1 // MaxUint32 or MaxUint64 depending on intSize.
53+
MaxUint8 = 1<<8 - 1 // 255
54+
MaxUint16 = 1<<16 - 1 // 65535
55+
MaxUint32 = 1<<32 - 1 // 4294967295
56+
MaxUint64 = 1<<64 - 1 // 18446744073709551615
5757
)

0 commit comments

Comments
 (0)