mirror of https://github.com/golang/go.git
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>
This commit is contained in:
parent
efa43c57b1
commit
bb46b754be
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue