aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/hashmap.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2017-04-16 06:27:24 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2017-04-19 13:43:01 +0000
commit17d497feaabfee336e9eaec91803a5e9aff77bdb (patch)
tree49e4e74e99278a0ab424ecf839201001fab1d8ec /src/runtime/hashmap.go
parenta41b1d50523c3fc6fb874310d4340b845b13b250 (diff)
downloadgo-17d497feaabfee336e9eaec91803a5e9aff77bdb.tar.xz
runtime: add bmap.setoverflow
bmap already has a overflow (getter) method. Add a setoverflow (setter) method, for readability. Updates #19931 Updates #19992 Change-Id: I00b3d94037c0d75508a7ebd51085c5c3857fb764 Reviewed-on: https://go-review.googlesource.com/40977 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/hashmap.go')
-rw-r--r--src/runtime/hashmap.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/runtime/hashmap.go b/src/runtime/hashmap.go
index 745ff40b5b..5243236f01 100644
--- a/src/runtime/hashmap.go
+++ b/src/runtime/hashmap.go
@@ -174,6 +174,10 @@ func (b *bmap) overflow(t *maptype) *bmap {
return *(**bmap)(add(unsafe.Pointer(b), uintptr(t.bucketsize)-sys.PtrSize))
}
+func (b *bmap) setoverflow(t *maptype, ovf *bmap) {
+ *(**bmap)(add(unsafe.Pointer(b), uintptr(t.bucketsize)-sys.PtrSize)) = ovf
+}
+
// incrnoverflow increments h.noverflow.
// noverflow counts the number of overflow buckets.
// This is used to trigger same-size map growth.
@@ -207,7 +211,7 @@ func (h *hmap) newoverflow(t *maptype, b *bmap) *bmap {
h.createOverflow()
*h.extra.overflow[0] = append(*h.extra.overflow[0], ovf)
}
- *(**bmap)(add(unsafe.Pointer(b), uintptr(t.bucketsize)-sys.PtrSize)) = ovf
+ b.setoverflow(t, ovf)
return ovf
}