runtime: improve atoi implementation

- Adds overflow checks
- Adds parsing of negative integers
- Adds boolean return value to signal parsing errors
- Adds atoi32 for parsing of integers that fit in an int32
- Adds tests

Handling of errors to provide error messages
at the call sites is left to future CLs.

Updates #17718

Change-Id: I3cacd0ab1230b9efc5404c68edae7304d39bcbc0
Reviewed-on: https://go-review.googlesource.com/32390
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Martin Möhrmann 2016-10-30 01:54:19 +02:00 committed by Brad Fitzpatrick
parent 40aaf28312
commit d7b34d5f29
6 changed files with 174 additions and 20 deletions

View file

@ -32,6 +32,9 @@ var FuncPC = funcPC
var Fastlog2 = fastlog2
var Atoi = atoi
var Atoi32 = atoi32
type LFNode struct {
Next uint64
Pushcnt uintptr