diff options
| author | Joel Sing <joel@sing.id.au> | 2025-11-06 01:05:29 +1100 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-11-10 09:48:20 -0800 |
| commit | bc5ffe5c79d45447648a012465e158f29ff5efa2 (patch) | |
| tree | c8cf367793a23859cd1c98c8ef24bbcc4697f3aa /src/internal/runtime/sys | |
| parent | 32f8d6486f02d5820977180c52889ec72c799d58 (diff) | |
| download | go-bc5ffe5c79d45447648a012465e158f29ff5efa2.tar.xz | |
internal/runtime/sys,math/bits: eliminate bounds checks on len8tab
The compiler cannot currently determine that the accesses to len8tab
are within bounds. Cast to uint8 to avoid unnecessary bounds checks.
Fixes #76166
Change-Id: I1fd930bba2b20d3998252c476308642e08ce00b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/718040
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/internal/runtime/sys')
| -rw-r--r-- | src/internal/runtime/sys/intrinsics.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/internal/runtime/sys/intrinsics.go b/src/internal/runtime/sys/intrinsics.go index 147d5581f2..69609192ce 100644 --- a/src/internal/runtime/sys/intrinsics.go +++ b/src/internal/runtime/sys/intrinsics.go @@ -109,7 +109,7 @@ func Len64(x uint64) (n int) { x >>= 8 n += 8 } - return n + int(len8tab[x]) + return n + int(len8tab[uint8(x)]) } // --- OnesCount --- |
