From 61043d467115365dbbc0937510c9b91fa4a28f1d Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Mon, 21 Aug 2017 09:51:35 -0700 Subject: [PATCH] runtime: use add in mapdelete* MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This better matches the style of the rest of the runtime. Change-Id: I6abb755df50eb3d9086678629c0d184177e1981f Reviewed-on: https://go-review.googlesource.com/57610 Run-TryBot: Josh Bleecher Snyder TryBot-Result: Gobot Gobot Reviewed-by: Martin Möhrmann --- src/runtime/hashmap.go | 2 +- src/runtime/hashmap_fast.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/runtime/hashmap.go b/src/runtime/hashmap.go index 9456500f00..1cfa9070fb 100644 --- a/src/runtime/hashmap.go +++ b/src/runtime/hashmap.go @@ -666,7 +666,7 @@ func mapdelete(t *maptype, h *hmap, key unsafe.Pointer) { if h.growing() { growWork(t, h, bucket) } - b := (*bmap)(unsafe.Pointer(uintptr(h.buckets) + bucket*uintptr(t.bucketsize))) + b := (*bmap)(add(h.buckets, bucket*uintptr(t.bucketsize))) top := tophash(hash) for { for i := uintptr(0); i < bucketCnt; i++ { diff --git a/src/runtime/hashmap_fast.go b/src/runtime/hashmap_fast.go index de52f2cc04..1d830cc8cf 100644 --- a/src/runtime/hashmap_fast.go +++ b/src/runtime/hashmap_fast.go @@ -646,7 +646,7 @@ func mapdelete_fast32(t *maptype, h *hmap, key uint32) { if h.growing() { growWork(t, h, bucket) } - b := (*bmap)(unsafe.Pointer(uintptr(h.buckets) + bucket*uintptr(t.bucketsize))) + b := (*bmap)(add(h.buckets, bucket*uintptr(t.bucketsize))) top := tophash(hash) for { for i := uintptr(0); i < bucketCnt; i++ { @@ -698,7 +698,7 @@ func mapdelete_fast64(t *maptype, h *hmap, key uint64) { if h.growing() { growWork(t, h, bucket) } - b := (*bmap)(unsafe.Pointer(uintptr(h.buckets) + bucket*uintptr(t.bucketsize))) + b := (*bmap)(add(h.buckets, bucket*uintptr(t.bucketsize))) top := tophash(hash) for { for i := uintptr(0); i < bucketCnt; i++ { @@ -751,7 +751,7 @@ func mapdelete_faststr(t *maptype, h *hmap, ky string) { if h.growing() { growWork(t, h, bucket) } - b := (*bmap)(unsafe.Pointer(uintptr(h.buckets) + bucket*uintptr(t.bucketsize))) + b := (*bmap)(add(h.buckets, bucket*uintptr(t.bucketsize))) top := tophash(hash) for { for i := uintptr(0); i < bucketCnt; i++ { -- 2.48.1