Commit fbc5acbd authored by Robert Griesemer's avatar Robert Griesemer

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/+/166417Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent cfa93ba5
......@@ -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:]
......
......@@ -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*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment