Commit 83ae9b07 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

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: 's avatarMartin Möhrmann <moehrmann@google.com>
parent f3e0d143
...@@ -658,7 +658,7 @@ func mapdelete_fast32(t *maptype, h *hmap, key uint32) { ...@@ -658,7 +658,7 @@ func mapdelete_fast32(t *maptype, h *hmap, key uint32) {
} }
// Only clear value if there are pointers in it. // Only clear value if there are pointers in it.
if t.elem.kind&kindNoPointers == 0 { 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) memclrHasPointers(v, t.elem.size)
} }
b.tophash[i] = empty b.tophash[i] = empty
...@@ -711,7 +711,7 @@ func mapdelete_fast64(t *maptype, h *hmap, key uint64) { ...@@ -711,7 +711,7 @@ func mapdelete_fast64(t *maptype, h *hmap, key uint64) {
} }
// Only clear value if there are pointers in it. // Only clear value if there are pointers in it.
if t.elem.kind&kindNoPointers == 0 { 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) memclrHasPointers(v, t.elem.size)
} }
b.tophash[i] = empty b.tophash[i] = empty
...@@ -767,7 +767,7 @@ func mapdelete_faststr(t *maptype, h *hmap, ky string) { ...@@ -767,7 +767,7 @@ func mapdelete_faststr(t *maptype, h *hmap, ky string) {
*(*string)(kptr) = "" *(*string)(kptr) = ""
// Only clear value if there are pointers in it. // Only clear value if there are pointers in it.
if t.elem.kind&kindNoPointers == 0 { 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) memclrHasPointers(v, t.elem.size)
} }
b.tophash[i] = empty b.tophash[i] = empty
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment