diff options
| author | Robert Griesemer <gri@golang.org> | 2019-03-08 17:30:55 -0800 |
|---|---|---|
| committer | Robert Griesemer <gri@golang.org> | 2019-03-12 22:59:06 +0000 |
| commit | fbc5acbd704ff2640d0aed19f116b862f858a549 (patch) | |
| tree | a3e92f7aed369c5f32f2555444801cba1740b3ea | |
| parent | cfa93ba51fb62252633c62ddc9351d56c18ce018 (diff) | |
| download | go-git-fbc5acbd704ff2640d0aed19f116b862f858a549.tar.gz | |
cmd/compile: remove work-arounds for handling underscores in numbers
With math/big supporting underscores directly, there is no need to
manually remove them before calling the math/big conversion routines.
Updates #28493.
Change-Id: I6f865c8f87c3469ffd6c33f960ed540135055226
Reviewed-on: https://go-review.googlesource.com/c/go/+/166417
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
| -rw-r--r-- | src/cmd/compile/internal/gc/mpfloat.go | 4 | ||||
| -rw-r--r-- | src/cmd/compile/internal/gc/mpint.go | 4 |
2 files changed, 0 insertions, 8 deletions
diff --git a/src/cmd/compile/internal/gc/mpfloat.go b/src/cmd/compile/internal/gc/mpfloat.go index 0379075406..d15f26784e 100644 --- a/src/cmd/compile/internal/gc/mpfloat.go +++ b/src/cmd/compile/internal/gc/mpfloat.go @@ -8,7 +8,6 @@ import ( "fmt" "math" "math/big" - "strings" ) // implements float arithmetic @@ -180,9 +179,6 @@ func (a *Mpflt) Neg() { } func (a *Mpflt) SetString(as string) { - // TODO(gri) remove this code once math/big.Float.Parse can handle separators - as = strings.Replace(as, "_", "", -1) // strip separators - // TODO(gri) why is this needed? for len(as) > 0 && (as[0] == ' ' || as[0] == '\t') { as = as[1:] diff --git a/src/cmd/compile/internal/gc/mpint.go b/src/cmd/compile/internal/gc/mpint.go index 81b60dd278..e4dd22d0a0 100644 --- a/src/cmd/compile/internal/gc/mpint.go +++ b/src/cmd/compile/internal/gc/mpint.go @@ -7,7 +7,6 @@ package gc import ( "fmt" "math/big" - "strings" ) // implements integer arithmetic @@ -282,9 +281,6 @@ func (a *Mpint) SetInt64(c int64) { } func (a *Mpint) SetString(as string) { - // TODO(gri) remove this code once math/big.Int.SetString can handle separators - as = strings.Replace(as, "_", "", -1) // strip separators - _, ok := a.Val.SetString(as, 0) if !ok { // required syntax is [+-][0[x]]d* |
