diff --git a/internal/runtime/z_slice.go b/internal/runtime/z_slice.go index 6eed5167..9e43ba04 100644 --- a/internal/runtime/z_slice.go +++ b/internal/runtime/z_slice.go @@ -20,6 +20,7 @@ import ( "unsafe" "github.com/goplus/llgo/c" + "github.com/goplus/llgo/internal/abi" "github.com/goplus/llgo/internal/runtime/math" ) @@ -141,4 +142,8 @@ func panicmakeslicecap() { panic(errorString("makeslice: cap out of range")) } +func SliceClear(t *abi.SliceType, s Slice) { + c.Memset(s.data, 0, uintptr(s.len)*t.Elem.Size()) +} + // -----------------------------------------------------------------------------