示例#1
0
文件: lz4.go 项目: avisagie/golz4
func Compress(in, out []byte) int {
	n := C.LZ4_compress((*C.char)(unsafe.Pointer(&in[0])), (*C.char)(unsafe.Pointer(&out[0])), C.int(len(in)))
	return (int)(n)
}
示例#2
0
文件: lz4.go 项目: postfix/go-lz4
/*
Compresses 'isize' bytes from 'source' into 'dest'.
Destination buffer must be already allocated,
and must be sized to handle worst cases situations (input data not compressible)
Worst case size evaluation is provided by CompressBound()

isize  : is the input size. Max supported value is ~1.9GB
return : the number of bytes written in buffer dest
*/
func Compress(source, dest []byte, isize int) int {
	return int(C.LZ4_compress(cast(source), cast(dest), C.int(isize)))
}