From aaa384cf3a510a1f1945010e2c0e2ba8d0282f91 Mon Sep 17 00:00:00 2001 From: chanxuehong Date: Thu, 17 Aug 2023 01:58:22 +0000 Subject: [PATCH] math/big, math/rand: use the built-in max function Change-Id: I71a38dd20bfaf2b1aed18892d54eeb017d3d7d66 GitHub-Last-Rev: 8da43b2cbd563ed123690709e519c9f84272b332 GitHub-Pull-Request: golang/go#61955 Reviewed-on: https://go-review.googlesource.com/c/go/+/518595 Run-TryBot: Ian Lance Taylor Reviewed-by: Dmitri Shuralyov TryBot-Result: Gopher Robot Auto-Submit: Ian Lance Taylor Reviewed-by: Ian Lance Taylor Reviewed-by: qiulaidongfeng <2645477756@qq.com> --- src/math/big/nat.go | 7 ------- src/math/rand/rand_test.go | 7 ------- 2 files changed, 14 deletions(-) diff --git a/src/math/big/nat.go b/src/math/big/nat.go index 90ce6d19c4..b9f4026a04 100644 --- a/src/math/big/nat.go +++ b/src/math/big/nat.go @@ -389,13 +389,6 @@ func addAt(z, x nat, i int) { } } -func max(x, y int) int { - if x > y { - return x - } - return y -} - // karatsubaLen computes an approximation to the maximum k <= n such that // k = p<= 0. Thus, the // result is the largest number that can be divided repeatedly by 2 before diff --git a/src/math/rand/rand_test.go b/src/math/rand/rand_test.go index 7eba1dc0d3..4ad2ae2230 100644 --- a/src/math/rand/rand_test.go +++ b/src/math/rand/rand_test.go @@ -33,13 +33,6 @@ type statsResults struct { maxError float64 } -func max(a, b float64) float64 { - if a > b { - return a - } - return b -} - func nearEqual(a, b, closeEnough, maxError float64) bool { absDiff := math.Abs(a - b) if absDiff < closeEnough { // Necessary when one value is zero and one value is close to zero. -- 2.50.0