]> Cypherpunks repositories - gostls13.git/commitdiff
math: show value of integer constants in comments
authorShulhan <m.shulhan@gmail.com>
Sat, 21 Aug 2021 09:50:25 +0000 (16:50 +0700)
committerGopher Robot <gobot@golang.org>
Wed, 21 Sep 2022 14:07:39 +0000 (14:07 +0000)
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>

src/math/const.go

index 5ea935fb42539d9787629ba8d1b2db4482db4895..b15e50e01820837acc344aa5646e1633f07dc8f1 100644 (file)
@@ -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
 )