mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
runtime: correctly copy a zero-length buffer backwards
Fixes: https://github.com/aykevl/tinygo/issues/64
This commit is contained in:
@@ -54,13 +54,9 @@ func memmove(dst, src unsafe.Pointer, size uintptr) {
|
||||
return
|
||||
}
|
||||
// Copy backwards.
|
||||
i := size
|
||||
for {
|
||||
for i := size; i != 0; {
|
||||
i--
|
||||
*(*uint8)(unsafe.Pointer(uintptr(dst) + i)) = *(*uint8)(unsafe.Pointer(uintptr(src) + i))
|
||||
if i == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user