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 <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Keith Randall <khr@golang.org>
import (
"bytes"
- "cmd/compile/internal/big"
"cmd/internal/obj"
)
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
// 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)
"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