milvus/pkg/util/cgoconverter/test_utils.go
jaime c9d0c157ec
Move some modules from internal to public package (#22572)
Signed-off-by: jaime <yun.zhang@zilliz.com>
2023-04-06 19:14:32 +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
}