aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2024-08-12 16:38:58 -0400
committerGopher Robot <gobot@golang.org>2024-10-28 20:35:22 +0000
commitbb46b754bebb0e820d74fd9eb02635afbdf5a3bd (patch)
tree9915f3daff04cd7a75138d510f8d8187d2f7b6e7 /src
parentefa43c57b109582d602eeb9b5fb690d38e4cf9aa (diff)
downloadgo-bb46b754bebb0e820d74fd9eb02635afbdf5a3bd.tar.xz
internal/runtime/maps: speed up modulo
For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap Change-Id: Ic47721e101f6fee650e6825a5a241fcd12fa0009 Reviewed-on: https://go-review.googlesource.com/c/go/+/611185 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/internal/runtime/maps/table.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/internal/runtime/maps/table.go b/src/internal/runtime/maps/table.go
index 60f4263100..232c077db3 100644
--- a/src/internal/runtime/maps/table.go
+++ b/src/internal/runtime/maps/table.go
@@ -571,7 +571,7 @@ func (it *Iter) Next() {
//
// We could avoid most of these lookups if we left a flag
// behind on the old table to denote that it is stale.
- dirIdx := int((uint64(it.dirIdx) + it.dirOffset) % uint64(len(it.m.directory)))
+ dirIdx := int((uint64(it.dirIdx) + it.dirOffset) & uint64(len(it.m.directory)-1))
newTab := it.m.directory[dirIdx]
if it.tab == nil {
if newTab.index != dirIdx {