From b5f87b5407916c4049a3158cc944cebfd7a883a9 Mon Sep 17 00:00:00 2001 From: qiulaidongfeng <2645477756@qq.com> Date: Tue, 10 Oct 2023 12:43:40 +0000 Subject: runtime: use max/min func Change-Id: I3f0b7209621b39cee69566a5cc95e4343b4f1f20 GitHub-Last-Rev: af9dbbe69ad74e8c210254dafa260a886b690853 GitHub-Pull-Request: golang/go#63321 Reviewed-on: https://go-review.googlesource.com/c/go/+/531916 LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall Reviewed-by: Mauri de Souza Meneguzzo Reviewed-by: Dmitri Shuralyov Reviewed-by: Keith Randall --- src/runtime/export_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/runtime/export_test.go') diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index fc681b140e..6d1d3c4537 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -806,7 +806,7 @@ func (b *PallocBits) PopcntRange(i, n uint) uint { return (*pageBits)(b).popcntR // SummarizeSlow is a slow but more obviously correct implementation // of (*pallocBits).summarize. Used for testing. func SummarizeSlow(b *PallocBits) PallocSum { - var start, max, end uint + var start, most, end uint const N = uint(len(b)) * 64 for start < N && (*pageBits)(b).get(start) == 0 { @@ -822,11 +822,9 @@ func SummarizeSlow(b *PallocBits) PallocSum { } else { run = 0 } - if run > max { - max = run - } + most = max(most, run) } - return PackPallocSum(start, max, end) + return PackPallocSum(start, most, end) } // Expose non-trivial helpers for testing. -- cgit v1.3-5-g45d5