From fbc5acbd704ff2640d0aed19f116b862f858a549 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Fri, 8 Mar 2019 17:30:55 -0800 Subject: [PATCH] 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 Reviewed-by: Brad Fitzpatrick --- src/cmd/compile/internal/gc/mpfloat.go | 4 ---- src/cmd/compile/internal/gc/mpint.go | 4 ---- 2 files changed, 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* -- 2.50.0