diff options
Diffstat (limited to 'libgo/go/strconv/atoi.go')
-rw-r--r-- | libgo/go/strconv/atoi.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libgo/go/strconv/atoi.go b/libgo/go/strconv/atoi.go index 59ef264d17c..bdd5d71f875 100644 --- a/libgo/go/strconv/atoi.go +++ b/libgo/go/strconv/atoi.go @@ -44,7 +44,7 @@ func cutoff64(base int) uint64 { } // ParseUint is like ParseInt but for unsigned numbers. -func ParseUint(s string, b int, bitSize int) (n uint64, err error) { +func ParseUint(s string, base int, bitSize int) (n uint64, err error) { var cutoff, maxVal uint64 if bitSize == 0 { @@ -57,32 +57,32 @@ func ParseUint(s string, b int, bitSize int) (n uint64, err error) { err = ErrSyntax goto Error - case 2 <= b && b <= 36: + case 2 <= base && base <= 36: // valid base; nothing to do - case b == 0: + case base == 0: // Look for octal, hex prefix. switch { case s[0] == '0' && len(s) > 1 && (s[1] == 'x' || s[1] == 'X'): - b = 16 + base = 16 s = s[2:] if len(s) < 1 { err = ErrSyntax goto Error } case s[0] == '0': - b = 8 + base = 8 default: - b = 10 + base = 10 } default: - err = errors.New("invalid base " + Itoa(b)) + err = errors.New("invalid base " + Itoa(base)) goto Error } n = 0 - cutoff = cutoff64(b) + cutoff = cutoff64(base) maxVal = 1<<uint(bitSize) - 1 for i := 0; i < len(s); i++ { @@ -100,19 +100,19 @@ func ParseUint(s string, b int, bitSize int) (n uint64, err error) { err = ErrSyntax goto Error } - if int(v) >= b { + if int(v) >= base { n = 0 err = ErrSyntax goto Error } if n >= cutoff { - // n*b overflows + // n*base overflows n = 1<<64 - 1 err = ErrRange goto Error } - n *= uint64(b) + n *= uint64(base) n1 := n + uint64(v) if n1 < n || n1 > maxVal { |