Ejemplo n.º 1
0
Archivo: lzo.go Proyecto: presbrey/lzo
func lzoCompressSpeed(src []byte, dst []byte, dst_size *int) C.int {
	wrkmem := make([]byte, int(C.lzo1x_1_mem_compress()))
	return C.lzo1x_1_compress((*C.uchar)(unsafe.Pointer(&src[0])), C.lzo_uint(len(src)),
		(*C.uchar)(unsafe.Pointer(&dst[0])), (*C.lzo_uint)(unsafe.Pointer(dst_size)),
		unsafe.Pointer(&wrkmem[0]))
}
Ejemplo n.º 2
0
// wrap the C calls so we can store a function pointer to them
func lzo1x_1_compress(b []byte, out []byte, out_size *int, wrkmem []byte) C.int {
	return C.lzo1x_1_compress((*C.uchar)(unsafe.Pointer(&b[0])), C.lzo_uint(len(b)),
		(*C.uchar)(unsafe.Pointer(&out[0])), (*C.lzo_uint)(unsafe.Pointer(out_size)),
		unsafe.Pointer(&wrkmem[0]))
}