aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/hashmap.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/hashmap.go b/src/runtime/hashmap.go
index 1f16fe4e56..22470a08e9 100644
--- a/src/runtime/hashmap.go
+++ b/src/runtime/hashmap.go
@@ -1129,7 +1129,7 @@ func evacuate(t *maptype, h *hmap, oldbucket uintptr) {
dst.k = add(unsafe.Pointer(dst.b), dataOffset)
dst.v = add(dst.k, bucketCnt*uintptr(t.keysize))
}
- dst.b.tophash[dst.i] = top
+ dst.b.tophash[dst.i&(bucketCnt-1)] = top // mask dst.i as an optimization, to avoid a bounds check
if t.indirectkey {
*(*unsafe.Pointer)(dst.k) = k2 // copy pointer
} else {