runtime: avoid bound check in freebsd binuptime

Fixes #76062

Change-Id: I683c1232aaeac12b0b3688472bb277adb95ad542
Reviewed-on: https://go-review.googlesource.com/c/go/+/715180
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
This commit is contained in:
Cuong Manh Le 2025-10-27 16:47:20 +07:00 committed by Gopher Robot
parent 916e682d51
commit dec2b4c83d

View file

@ -54,6 +54,9 @@ func binuptime(abs bool) (bt bintime) {
} }
curr := atomic.Load(&timekeepSharedPage.current) // atomic_load_acq_32 curr := atomic.Load(&timekeepSharedPage.current) // atomic_load_acq_32
if curr >= uint32(len(timehands)) {
return zeroBintime
}
th := &timehands[curr] th := &timehands[curr]
gen := atomic.Load(&th.gen) // atomic_load_acq_32 gen := atomic.Load(&th.gen) // atomic_load_acq_32
bt = th.offset bt = th.offset