milvus/internal/util/cgoconverter/test_utils.go
SimFG aa7014a360
enhance: move the cgo code in the pkg dir to interal dir (#30261)
/kind improvement

Signed-off-by: SimFG <bang.fu@zilliz.com>
2024-01-25 15:15:01 +08:00

21 lines
304 B
Go

package cgoconverter
/*
#include <stdlib.h>
#include <string.h>
*/
import "C"
import "unsafe"
func copyToCBytes(data []byte) unsafe.Pointer {
return C.CBytes(data)
}
func mallocCBytes(v byte, len int) unsafe.Pointer {
p := C.malloc(C.size_t(len))
C.memset(p, C.int(v), C.size_t(len))
return p
}