]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use add in mapdelete*
authorJosh Bleecher Snyder <josharian@gmail.com>
Mon, 21 Aug 2017 16:51:35 +0000 (09:51 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Wed, 23 Aug 2017 13:49:29 +0000 (13:49 +0000)
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 <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
src/runtime/hashmap.go
src/runtime/hashmap_fast.go

index 9456500f001c392f15e54afb60cc5e7e8d1e22ff..1cfa9070fb7a179d085fdf374e3635c9bb2d291f 100644 (file)
@@ -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++ {
index de52f2cc04f973c166dc52bff216c71e924d45b3..1d830cc8cfeb3471fe3bdb645f2bac793cd48786 100644 (file)
@@ -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++ {