github.com/moontrade/nogc@v0.1.7/alloc/tlsf/mem_tinygounix.go (about) 1 //go:build tinygo && !tinygo.wasm && (darwin || linux || windows) 2 // +build tinygo 3 // +build !tinygo.wasm 4 // +build darwin linux windows 5 6 package tlsf 7 8 import "unsafe" 9 10 //go:linkname Malloc runtime.malloc 11 func Malloc(size uintptr) unsafe.Pointer 12 13 //go:linkname Copy runtime.gcMemcpy 14 func Copy(dst, src unsafe.Pointer, n uintptr) 15 16 //go:linkname Zero runtime.gcZero 17 func Zero(ptr unsafe.Pointer, size uintptr) 18 19 //go:linkname Equals runtime.gcMemequal 20 func Equals(x, y unsafe.Pointer, size uintptr) bool 21 22 //// TODO: Faster LLVM way? 23 //func memequal(a, b unsafe.Pointer, n uintptr) bool { 24 // return gcMemequal(a, b, n) 25 // //if a == nil { 26 // // return b == nil 27 // //} 28 // //return *(*string)(unsafe.Pointer(&_string{ 29 // // ptr: uintptr(a), 30 // // len: int(n), 31 // //})) == *(*string)(unsafe.Pointer(&_string{ 32 // // ptr: uintptr(b), 33 // // len: int(n), 34 // //})) 35 //}