cmd/compile: change Mp{int,flt} functions into methods

Also give them more idiomatic Go names. Adding godocs is outside the
scope of this CL. (Besides, the method names almost all directly
parallel an underlying math/big.Int or math/big.Float method.)

CL prepared mechanically with sed (for rewriting mpint.go/mpfloat.go)
and gofmt (for rewriting call sites).

Passes toolstash -cmp.

Change-Id: Id76f4aee476ba740f48db33162463e7978c2083d
Reviewed-on: https://go-review.googlesource.com/20909
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Matthew Dempsky 2016-03-20 13:55:42 -07:00 committed by Robert Griesemer
parent 5fb6aa3e09
commit d3253876f2
20 changed files with 315 additions and 315 deletions

View file

@ -484,7 +484,7 @@ func (p *importer) value(typ *Type) (x Val) {
case int64Tag:
u := new(Mpint)
Mpmovecfix(u, p.int64())
u.SetInt64(p.int64())
u.Rune = typ == idealrune
x.U = u
@ -494,7 +494,7 @@ func (p *importer) value(typ *Type) (x Val) {
if typ == idealint || Isint[typ.Etype] {
// uncommon case: large int encoded as float
u := new(Mpint)
mpmovefltfix(u, f)
u.SetFloat(f)
x.U = u
break
}
@ -530,7 +530,7 @@ func (p *importer) value(typ *Type) (x Val) {
func (p *importer) float(x *Mpflt) {
sign := p.int()
if sign == 0 {
Mpmovecflt(x, 0)
x.SetFloat64(0)
return
}