Skip to content

Commit 5378922

Browse files
Juneezeepull[bot]
authored andcommitted
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]>
1 parent 285ddcb commit 5378922

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/math/big/float.go

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ func (z *Float) SetInt(x *Int) *Float {
602602
// are many trailing 0's.
603603
bits := uint32(x.BitLen())
604604
if z.prec == 0 {
605-
z.prec = umax32(bits, 64)
605+
z.prec = max(bits, 64)
606606
}
607607
z.acc = Exact
608608
z.neg = x.neg
@@ -628,7 +628,7 @@ func (z *Float) SetRat(x *Rat) *Float {
628628
a.SetInt(x.Num())
629629
b.SetInt(x.Denom())
630630
if z.prec == 0 {
631-
z.prec = umax32(a.prec, b.prec)
631+
z.prec = max(a.prec, b.prec)
632632
}
633633
return z.Quo(&a, &b)
634634
}
@@ -1451,7 +1451,7 @@ func (z *Float) Add(x, y *Float) *Float {
14511451
}
14521452

14531453
if z.prec == 0 {
1454-
z.prec = umax32(x.prec, y.prec)
1454+
z.prec = max(x.prec, y.prec)
14551455
}
14561456

14571457
if x.form == finite && y.form == finite {
@@ -1525,7 +1525,7 @@ func (z *Float) Sub(x, y *Float) *Float {
15251525
}
15261526

15271527
if z.prec == 0 {
1528-
z.prec = umax32(x.prec, y.prec)
1528+
z.prec = max(x.prec, y.prec)
15291529
}
15301530

15311531
if x.form == finite && y.form == finite {
@@ -1592,7 +1592,7 @@ func (z *Float) Mul(x, y *Float) *Float {
15921592
}
15931593

15941594
if z.prec == 0 {
1595-
z.prec = umax32(x.prec, y.prec)
1595+
z.prec = max(x.prec, y.prec)
15961596
}
15971597

15981598
z.neg = x.neg != y.neg
@@ -1637,7 +1637,7 @@ func (z *Float) Quo(x, y *Float) *Float {
16371637
}
16381638

16391639
if z.prec == 0 {
1640-
z.prec = umax32(x.prec, y.prec)
1640+
z.prec = max(x.prec, y.prec)
16411641
}
16421642

16431643
z.neg = x.neg != y.neg
@@ -1724,10 +1724,3 @@ func (x *Float) ord() int {
17241724
}
17251725
return m
17261726
}
1727-
1728-
func umax32(x, y uint32) uint32 {
1729-
if x > y {
1730-
return x
1731-
}
1732-
return y
1733-
}

0 commit comments

Comments
 (0)