From: Matthew Dempsky Date: Tue, 1 Mar 2016 04:20:13 +0000 (-0800) Subject: cmd/compile: give mparith{2,3}.go files more meaningful names X-Git-Tag: go1.7beta1~1630 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=35dd2ed58d281df6542fa0fb5a884b9c48cdaac9;p=gostls13.git cmd/compile: give mparith{2,3}.go files more meaningful names Also, relocate related const and type definitions from go.go. Change-Id: Ieb9b672da8dd510ca67022b4f7ae49a778a56579 Reviewed-on: https://go-review.googlesource.com/20080 Run-TryBot: Matthew Dempsky Reviewed-by: Dave Cheney Reviewed-by: Keith Randall --- diff --git a/src/cmd/compile/internal/gc/go.go b/src/cmd/compile/internal/gc/go.go index df460f8ddc..ce3ad003c0 100644 --- a/src/cmd/compile/internal/gc/go.go +++ b/src/cmd/compile/internal/gc/go.go @@ -6,7 +6,6 @@ package gc import ( "bytes" - "cmd/compile/internal/big" "cmd/internal/obj" ) @@ -17,32 +16,6 @@ const ( MaxStackVarSize = 10 * 1024 * 1024 ) -const ( - // Maximum size in bits for Mpints before signalling - // overflow and also mantissa precision for Mpflts. - Mpprec = 512 - // Turn on for constant arithmetic debugging output. - Mpdebug = false -) - -// Mpint represents an integer constant. -type Mpint struct { - Val big.Int - Ovf bool // set if Val overflowed compiler limit (sticky) - Rune bool // set if syntax indicates default type rune -} - -// Mpflt represents a floating-point constant. -type Mpflt struct { - Val big.Float -} - -// Mpcplx represents a complex constant. -type Mpcplx struct { - Real Mpflt - Imag Mpflt -} - type Val struct { // U contains one of: // bool bool when n.ValCtype() == CTBOOL diff --git a/src/cmd/compile/internal/gc/mparith3.go b/src/cmd/compile/internal/gc/mpfloat.go similarity index 92% rename from src/cmd/compile/internal/gc/mparith3.go rename to src/cmd/compile/internal/gc/mpfloat.go index 5b61a9e17f..48aa1efc6d 100644 --- a/src/cmd/compile/internal/gc/mparith3.go +++ b/src/cmd/compile/internal/gc/mpfloat.go @@ -13,6 +13,25 @@ import ( // implements float arithmetic +const ( + // Maximum size in bits for Mpints before signalling + // overflow and also mantissa precision for Mpflts. + Mpprec = 512 + // Turn on for constant arithmetic debugging output. + Mpdebug = false +) + +// Mpflt represents a floating-point constant. +type Mpflt struct { + Val big.Float +} + +// Mpcplx represents a complex constant. +type Mpcplx struct { + Real Mpflt + Imag Mpflt +} + func newMpflt() *Mpflt { var a Mpflt a.Val.SetPrec(Mpprec) diff --git a/src/cmd/compile/internal/gc/mparith2.go b/src/cmd/compile/internal/gc/mpint.go similarity index 96% rename from src/cmd/compile/internal/gc/mparith2.go rename to src/cmd/compile/internal/gc/mpint.go index 67faf29479..c2f1884b85 100644 --- a/src/cmd/compile/internal/gc/mparith2.go +++ b/src/cmd/compile/internal/gc/mpint.go @@ -10,7 +10,14 @@ import ( "fmt" ) -/// implements fix arithmetic +// implements integer arithmetic + +// Mpint represents an integer constant. +type Mpint struct { + Val big.Int + Ovf bool // set if Val overflowed compiler limit (sticky) + Rune bool // set if syntax indicates default type rune +} func mpsetovf(a *Mpint) { a.Val.SetUint64(1) // avoid spurious div-zero errors