benchfmt: use constant to avoid repeated definitions
Change-Id: I5e1d09c6c5706f5d26cba9d3fadd215e609983c9
GitHub-Last-Rev: acb9c808508b84fcdd9dd1df974e6f9a18c66a00
GitHub-Pull-Request: golang/perf#7
Reviewed-on: https://go-review.googlesource.com/c/perf/+/431635
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
diff --git a/benchfmt/internal/bytesconv/atoi.go b/benchfmt/internal/bytesconv/atoi.go
index 4cc871a..70ac2f1 100644
--- a/benchfmt/internal/bytesconv/atoi.go
+++ b/benchfmt/internal/bytesconv/atoi.go
@@ -6,6 +6,7 @@
import (
"errors"
+ "math"
"strconv"
)
@@ -55,7 +56,6 @@
// IntSize is the size in bits of an int or uint value.
const IntSize = intSize
-const maxUint64 = 1<<64 - 1
// ParseUint is like ParseInt but for unsigned numbers.
func ParseUint(s []byte, base int, bitSize int) (uint64, error) {
@@ -107,11 +107,11 @@
var cutoff uint64
switch base {
case 10:
- cutoff = maxUint64/10 + 1
+ cutoff = math.MaxUint64/10 + 1
case 16:
- cutoff = maxUint64/16 + 1
+ cutoff = math.MaxUint64/16 + 1
default:
- cutoff = maxUint64/uint64(base) + 1
+ cutoff = math.MaxUint64/uint64(base) + 1
}
maxVal := uint64(1)<<uint(bitSize) - 1