]> Cypherpunks repositories - gostls13.git/commitdiff
math/big: use built-in max function
authorEng Zer Jun <engzerjun@gmail.com>
Sun, 12 Jan 2025 10:02:45 +0000 (18:02 +0800)
committerGopher Robot <gobot@golang.org>
Mon, 3 Feb 2025 16:25:31 +0000 (08:25 -0800)
Change-Id: I65721039dab311762e55c6a60dd75b82f6b4622f
Reviewed-on: https://go-review.googlesource.com/c/go/+/642335
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

src/math/big/float.go

index 813c4ebfa7477f830df2958e11d40cee502abd05..e1d20d8bb4c0088920e3069d73bdac84968dbcc9 100644 (file)
@@ -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
-}