1
0
mirror of https://github.com/golang/go synced 2024-11-05 15:46:11 -07:00

strconv: remove redundant conversions to int

IntSize is an untyped constant that does not need explicit conversion.
Annotating IntSize as an int and running github.com/mdempsky/unconvert
reveals these two cases.

Fixes #38682.

Change-Id: I014646b7457ddcde32474810153229dcf0c269c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/230306
Run-TryBot: Akhil Indurti <aindurti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
smasher164 2020-04-27 13:23:24 -04:00 committed by Brad Fitzpatrick
parent 287d1ec96c
commit 0a364330a2

View File

@ -96,7 +96,7 @@ func ParseUint(s string, base int, bitSize int) (uint64, error) {
} }
if bitSize == 0 { if bitSize == 0 {
bitSize = int(IntSize) bitSize = IntSize
} else if bitSize < 0 || bitSize > 64 { } else if bitSize < 0 || bitSize > 64 {
return 0, bitSizeError(fnParseUint, s0, bitSize) return 0, bitSizeError(fnParseUint, s0, bitSize)
} }
@ -203,7 +203,7 @@ func ParseInt(s string, base int, bitSize int) (i int64, err error) {
} }
if bitSize == 0 { if bitSize == 0 {
bitSize = int(IntSize) bitSize = IntSize
} }
cutoff := uint64(1 << uint(bitSize-1)) cutoff := uint64(1 << uint(bitSize-1))