mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 11:59:00 +08:00
20 lines
301 B
Go
20 lines
301 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.ulong(len))
|
||
|
C.memset(p, C.int(v), C.ulong(len))
|
||
|
|
||
|
return p
|
||
|
}
|