From: Josh Bleecher Snyder Date: Wed, 23 Aug 2017 14:48:04 +0000 (-0700) Subject: runtime: convert more unsafe.Pointer arithmetic to add X-Git-Tag: go1.10beta1~1391 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=83ae9b07b8a99e21a1a2d7a19b253ae01cb84f06;p=gostls13.git runtime: convert more unsafe.Pointer arithmetic to add 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 --- 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