github.com/koykov/openrt@v0.0.0-20240411200908-3abd933415e1/memclr.go (about) 1 package openrt 2 3 import "unsafe" 4 5 func Memclr(p []byte) { 6 if len(p) == 0 { 7 return 8 } 9 MemclrUnsafe(unsafe.Pointer(&p[0]), len(p)) 10 } 11 12 func MemclrUnsafe(ptr unsafe.Pointer, len_ int) { 13 memclrNoHeapPointers(ptr, uintptr(len_)) 14 } 15 16 //go:noescape 17 //go:linkname memclrNoHeapPointers runtime.memclrNoHeapPointers 18 func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)