]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove work-arounds for handling underscores in numbers
authorRobert Griesemer <gri@golang.org>
Sat, 9 Mar 2019 01:30:55 +0000 (17:30 -0800)
committerRobert Griesemer <gri@golang.org>
Tue, 12 Mar 2019 22:59:06 +0000 (22:59 +0000)
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>
src/cmd/compile/internal/gc/mpfloat.go
src/cmd/compile/internal/gc/mpint.go

index 037907540620691d6d04b620e817d6fb91cc57c7..d15f26784edd0a6157430bc2fc2aa9150daee3cd 100644 (file)
@@ -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:]
index 81b60dd27822b81423c1b9713beae8ec614bc945..e4dd22d0a02e061ebceeb42428a495406a113ce0 100644 (file)
@@ -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*