Defines | Functions

fastlz.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define FASTLZ_VERSION   0x000100
#define FASTLZ_VERSION_MAJOR   0
#define FASTLZ_VERSION_MINOR   0
#define FASTLZ_VERSION_REVISION   0
#define FASTLZ_VERSION_STRING   "0.1.0"

Functions

int fastlz_compress (const void *input, int length, void *output)
 Compress a block of data in the input buffer and returns the size of compressed block.
int fastlz_decompress (const void *input, int length, void *output, int maxout)
 Decompress a block of compressed data and returns the size of the decompressed block.
int fastlz_compress_level (int level, const void *input, int length, void *output)
 Compress a block of data in the input buffer and returns the size of compressed block.

Define Documentation

#define FASTLZ_VERSION   0x000100

Definition at line 30 of file fastlz.h.

#define FASTLZ_VERSION_MAJOR   0

Definition at line 32 of file fastlz.h.

#define FASTLZ_VERSION_MINOR   0

Definition at line 33 of file fastlz.h.

#define FASTLZ_VERSION_REVISION   0

Definition at line 34 of file fastlz.h.

#define FASTLZ_VERSION_STRING   "0.1.0"

Definition at line 36 of file fastlz.h.


Function Documentation

int fastlz_compress ( const void *  input,
int  length,
void *  output 
)

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.

Definition at line 130 of file fastlz.c.

Referenced by RamCacheCLFUS::compress_entries().

int fastlz_compress_level ( int  level,
const void *  input,
int  length,
void *  output 
)

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.

Definition at line 154 of file fastlz.c.

int fastlz_decompress ( const void *  input,
int  length,
void *  output,
int  maxout 
)

Decompress a block of compressed data and returns the size of the decompressed block.

If error occurs, e.g. the compressed data is corrupted or the output buffer is not large enough, then 0 (zero) will be returned instead.

The input buffer and the output buffer can not overlap.

Decompression is memory safe and guaranteed not to write the output buffer more than what is specified in maxout.

Definition at line 140 of file fastlz.c.

Referenced by RamCacheCLFUS::get().