diff --git a/src/runtime/runtime_wasm.go b/src/runtime/runtime_wasm.go index 8212d859..4abc1cd7 100644 --- a/src/runtime/runtime_wasm.go +++ b/src/runtime/runtime_wasm.go @@ -2,6 +2,10 @@ package runtime +import ( + "unsafe" +) + type timeUnit int64 const tickMicros = 1 @@ -48,3 +52,11 @@ func ticks() timeUnit { func abort() { 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 +}