Copied from the ARM runtime and modified to return a pointer.
https://pubs.opengroup.org/onlinepubs/9699919799/functions/memset.html
Этот коммит содержится в:
Seth Junot 2019-01-17 17:51:58 -08:00 коммит произвёл Ayke van Laethem
родитель 95e18f36d0
коммит 67fbfe6305
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E97FF5335DFDFDED

Просмотреть файл

@ -2,6 +2,10 @@
package runtime package runtime
import (
"unsafe"
)
type timeUnit int64 type timeUnit int64
const tickMicros = 1 const tickMicros = 1
@ -48,3 +52,11 @@ func ticks() timeUnit {
func abort() { func abort() {
trap() trap()
} }
//go:export memset
func memset(ptr unsafe.Pointer, c byte, size uintptr) unsafe.Pointer {
for i := uintptr(0); i < size; i++ {
*(*byte)(unsafe.Pointer(uintptr(ptr) + i)) = c
}
return ptr
}