Function fastlz_sys::fastlz_compress_level[][src]

pub unsafe extern "C" fn fastlz_compress_level(
    level: c_int,
    input: *const c_void,
    length: c_int,
    output: *mut c_void
) -> c_int

Compress a block of data in the input buffer and returns the size of compressed block. The size of input buffer is specified by length. The minimum input buffer size is 16.

The output buffer must be at least 5% larger than the input buffer and can not be smaller than 66 bytes.

If the input is not compressible, the return value might be larger than length (input buffer size).

The input buffer and the output buffer can not overlap.

Compression level can be specified in parameter level. At the moment, only level 1 and level 2 are supported. Level 1 is the fastest compression and generally useful for short data. Level 2 is slightly slower but it gives better compression ratio.

Note that the compressed data, regardless of the level, can always be decompressed using the function fastlz_decompress above.