aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorJes Cok <xigua67damn@gmail.com>2023-09-12 13:18:33 +0000
committerGopher Robot <gobot@golang.org>2023-09-12 20:16:26 +0000
commitca102e5c4a65c942856faa18557261f8297e72d3 (patch)
tree4b1ca43f8ae79df304d6cb52cb2957ac376e14e8 /src/runtime
parentd8b349ea6063a1c977e88cc25785b91d7f4b6237 (diff)
downloadgo-ca102e5c4a65c942856faa18557261f8297e72d3.tar.xz
all: calculate the median uniformly
This is a follow up of CL 526496. Change-Id: I9f351951bf975e31befd36b9c951d195d2f8f9f7 GitHub-Last-Rev: 4307adafbffef7494d6f807b69df3e56328d6bf4 GitHub-Pull-Request: golang/go#62590 Reviewed-on: https://go-review.googlesource.com/c/go/+/527576 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/mranges.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/mranges.go b/src/runtime/mranges.go
index 4388d26088..6dd1a75247 100644
--- a/src/runtime/mranges.go
+++ b/src/runtime/mranges.go
@@ -271,7 +271,7 @@ func (a *addrRanges) findSucc(addr uintptr) int {
const iterMax = 8
bot, top := 0, len(a.ranges)
for top-bot > iterMax {
- i := ((top - bot) / 2) + bot
+ i := int(uint(bot+top) >> 1)
if a.ranges[i].contains(base.addr()) {
// a.ranges[i] contains base, so
// its successor is the next index.