mirror of
https://github.com/golang/go
synced 2024-11-19 16:24:45 -07:00
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>
This commit is contained in:
parent
f3e0d14313
commit
83ae9b07b8
@ -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) {
|
|||||||
}
|
}
|
||||||
// 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) {
|
|||||||
*(*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
|
||||||
|
Loading…
Reference in New Issue
Block a user