mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: use max/min func
Change-Id: I3f0b7209621b39cee69566a5cc95e4343b4f1f20
GitHub-Last-Rev: af9dbbe69a
GitHub-Pull-Request: golang/go#63321
Reviewed-on: https://go-review.googlesource.com/c/go/+/531916
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
9ab5121691
commit
b5f87b5407
10 changed files with 39 additions and 68 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue