From: Eng Zer Jun Date: Sun, 12 Jan 2025 10:02:45 +0000 (+0800) Subject: math/big: use built-in max function X-Git-Tag: go1.25rc1~1204 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=cc874072f3778a2b2cbe972b703dd6552ae63831;p=gostls13.git math/big: use built-in max function Change-Id: I65721039dab311762e55c6a60dd75b82f6b4622f Reviewed-on: https://go-review.googlesource.com/c/go/+/642335 Reviewed-by: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI Reviewed-by: Robert Griesemer Auto-Submit: Ian Lance Taylor --- diff --git a/src/math/big/float.go b/src/math/big/float.go index 813c4ebfa7..e1d20d8bb4 100644 --- a/src/math/big/float.go +++ b/src/math/big/float.go @@ -602,7 +602,7 @@ func (z *Float) SetInt(x *Int) *Float { // are many trailing 0's. bits := uint32(x.BitLen()) if z.prec == 0 { - z.prec = umax32(bits, 64) + z.prec = max(bits, 64) } z.acc = Exact z.neg = x.neg @@ -628,7 +628,7 @@ func (z *Float) SetRat(x *Rat) *Float { a.SetInt(x.Num()) b.SetInt(x.Denom()) if z.prec == 0 { - z.prec = umax32(a.prec, b.prec) + z.prec = max(a.prec, b.prec) } return z.Quo(&a, &b) } @@ -1451,7 +1451,7 @@ func (z *Float) Add(x, y *Float) *Float { } if z.prec == 0 { - z.prec = umax32(x.prec, y.prec) + z.prec = max(x.prec, y.prec) } if x.form == finite && y.form == finite { @@ -1525,7 +1525,7 @@ func (z *Float) Sub(x, y *Float) *Float { } if z.prec == 0 { - z.prec = umax32(x.prec, y.prec) + z.prec = max(x.prec, y.prec) } if x.form == finite && y.form == finite { @@ -1592,7 +1592,7 @@ func (z *Float) Mul(x, y *Float) *Float { } if z.prec == 0 { - z.prec = umax32(x.prec, y.prec) + z.prec = max(x.prec, y.prec) } z.neg = x.neg != y.neg @@ -1637,7 +1637,7 @@ func (z *Float) Quo(x, y *Float) *Float { } if z.prec == 0 { - z.prec = umax32(x.prec, y.prec) + z.prec = max(x.prec, y.prec) } z.neg = x.neg != y.neg @@ -1724,10 +1724,3 @@ func (x *Float) ord() int { } return m } - -func umax32(x, y uint32) uint32 { - if x > y { - return x - } - return y -}