mem: fix mem.Clear
This commit is contained in:
parent
04a5d3969d
commit
5a76937255
1 changed files with 2 additions and 2 deletions
|
|
@ -73,9 +73,9 @@ func Copy(dst, src unsafe.Pointer, size uintptr) unsafe.Pointer {
|
||||||
// Returns dst.
|
// Returns dst.
|
||||||
func Clear(dst unsafe.Pointer, value byte, count uintptr) unsafe.Pointer {
|
func Clear(dst unsafe.Pointer, value byte, count uintptr) unsafe.Pointer {
|
||||||
b := (*byte)(dst)
|
b := (*byte)(dst)
|
||||||
for range count { // @todo: loop unroll/maybe use asm?
|
for range count {
|
||||||
*b = value
|
*b = value
|
||||||
b = (*byte)(unsafe.Add(dst, 1))
|
b = (*byte)(unsafe.Add(unsafe.Pointer(b), 1))
|
||||||
}
|
}
|
||||||
return dst
|
return dst
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue