From 83ae9b07b8a99e21a1a2d7a19b253ae01cb84f06 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Wed, 23 Aug 2017 07:48:04 -0700 Subject: [PATCH] runtime: convert more unsafe.Pointer arithmetic to add MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Icfe24d5660666093f3e645f82d30b7687c8077be Reviewed-on: https://go-review.googlesource.com/58370 Run-TryBot: Josh Bleecher Snyder TryBot-Result: Gobot Gobot Reviewed-by: Martin Möhrmann --- src/runtime/hashmap_fast.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/runtime/hashmap_fast.go b/src/runtime/hashmap_fast.go index 27e5f50f87..f43d005a5b 100644 --- a/src/runtime/hashmap_fast.go +++ b/src/runtime/hashmap_fast.go @@ -658,7 +658,7 @@ func mapdelete_fast32(t *maptype, h *hmap, key uint32) { } // Only clear value if there are pointers in it. if t.elem.kind&kindNoPointers == 0 { - v := unsafe.Pointer(uintptr(unsafe.Pointer(b)) + dataOffset + bucketCnt*4 + i*uintptr(t.valuesize)) + v := add(unsafe.Pointer(b), dataOffset+bucketCnt*4+i*uintptr(t.valuesize)) memclrHasPointers(v, t.elem.size) } b.tophash[i] = empty @@ -711,7 +711,7 @@ func mapdelete_fast64(t *maptype, h *hmap, key uint64) { } // Only clear value if there are pointers in it. if t.elem.kind&kindNoPointers == 0 { - v := unsafe.Pointer(uintptr(unsafe.Pointer(b)) + dataOffset + bucketCnt*8 + i*uintptr(t.valuesize)) + v := add(unsafe.Pointer(b), dataOffset+bucketCnt*8+i*uintptr(t.valuesize)) memclrHasPointers(v, t.elem.size) } b.tophash[i] = empty @@ -767,7 +767,7 @@ func mapdelete_faststr(t *maptype, h *hmap, ky string) { *(*string)(kptr) = "" // Only clear value if there are pointers in it. if t.elem.kind&kindNoPointers == 0 { - v := unsafe.Pointer(uintptr(unsafe.Pointer(b)) + dataOffset + bucketCnt*2*sys.PtrSize + i*uintptr(t.valuesize)) + v := add(unsafe.Pointer(b), dataOffset+bucketCnt*2*sys.PtrSize+i*uintptr(t.valuesize)) memclrHasPointers(v, t.elem.size) } b.tophash[i] = empty