aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/hashmap_fast.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2017-08-23 07:48:04 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2017-08-24 13:55:34 +0000
commit83ae9b07b8a99e21a1a2d7a19b253ae01cb84f06 (patch)
tree61e44c04ec025b64a49be63be8e85e4a3a05e5ad /src/runtime/hashmap_fast.go
parentf3e0d143131dc318a173f4f5cc4e4b96de93318d (diff)
downloadgo-83ae9b07b8a99e21a1a2d7a19b253ae01cb84f06.tar.xz
runtime: convert more unsafe.Pointer arithmetic to add
Change-Id: Icfe24d5660666093f3e645f82d30b7687c8077be Reviewed-on: https://go-review.googlesource.com/58370 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Diffstat (limited to 'src/runtime/hashmap_fast.go')
-rw-r--r--src/runtime/hashmap_fast.go6
1 files 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