SyTen

◆ attempt_compression()

int syten::LZ4::attempt_compression ( const char *  src_begin,
char *  out_begin,
int  src_size,
int  max_out_size 
)

Attempts compression of src_size bytes, starting at src_begin, into a buffer out_begin of size max_out_size.

max_out_size has to be larger than or equal to src_size. Compression will be attempted with a buffer LZ4_MIN_PERCENT% the size of src_size. If compression was possible, the compressed data will start at out_begin and the function returns the number of bytes of compressed data. If compression was not possible or the compressed size is equal to the uncompressed size, the input data will be copied directly to the buffer starting at out_begin and src_size will be returned.

This means that if the function returns src_size, uncompressed data was copied to out_begin. If the function returns another number, this many bytes of LZ4-compressed data were written to out_begin.

References LZ4_MIN_PERCENT, std::memcpy(), std::min(), syten::EnvVars::no_lz4_compression, and SYTEN_ASSERT.

Referenced by syten::LZ4::Comp_SymFilter::filter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: