runtime: add missing SliceClear

This commit is contained in:
Li Jie
2024-12-31 21:02:51 +08:00
parent b3f4716616
commit e3a2d43ffa

View File

@@ -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())
}
// -----------------------------------------------------------------------------