mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
a41b1d5052
commit
17d497feaa
1 changed files with 5 additions and 1 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue