File syn_lz4.h¶
FileList > src > syntropic > util > syn_lz4.h
Go to the source code of this file
Zero-Heap LZ4 Raw Block Compression & Decompression. More...
#include "../common/syn_defs.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_Lz4 LZ4 Compression Workspace Context. |
Public Functions¶
| Type | Name |
|---|---|
| size_t | syn_lz4_compress (SYN_Lz4 * ctx, const void * src, size_t src_size, void * dst, size_t dst_capacity) Compress data buffer into LZ4 raw block format. |
| size_t | syn_lz4_compress_bound (size_t input_size) Calculate worst-case compressed output bound for a given input size. |
| size_t | syn_lz4_decompress (const void * src, size_t src_size, void * dst, size_t dst_capacity) Decompress LZ4 raw block buffer. |
| SYN_Status | syn_lz4_init (SYN_Lz4 * ctx) Initialize an LZ4 compression context. |
Macros¶
| Type | Name |
|---|---|
| define | SYN_LZ4_HASH_SIZE 4096U |
Detailed Description¶
Implements standard LZ4 raw block format compression and decompression without dynamic memory allocation or complex framing overhead.
Public Functions Documentation¶
function syn_lz4_compress¶
Compress data buffer into LZ4 raw block format.
size_t syn_lz4_compress (
SYN_Lz4 * ctx,
const void * src,
size_t src_size,
void * dst,
size_t dst_capacity
)
Parameters:
ctxPointer to initialized LZ4 context.srcSource data buffer to compress.src_sizeSource data size in bytes.dstDestination buffer for compressed output.dst_capacityCapacity of destination buffer in bytes.
Returns:
Number of compressed bytes written to dst, or 0 on error/overflow.
function syn_lz4_compress_bound¶
Calculate worst-case compressed output bound for a given input size.
Parameters:
input_sizeUncompressed payload size in bytes.
Returns:
Maximum compressed buffer size required.
function syn_lz4_decompress¶
Decompress LZ4 raw block buffer.
Decompression is fully stateless and requires no context workspace.
Parameters:
srcCompressed source buffer.src_sizeCompressed source size in bytes.dstDestination buffer for decompressed output.dst_capacityCapacity of destination buffer in bytes.
Returns:
Number of decompressed bytes written to dst, or 0 on corruption/overflow.
function syn_lz4_init¶
Initialize an LZ4 compression context.
Parameters:
ctxPointer to LZ4 context instance.
Returns:
SYN_OK on success, or SYN_INVALID_PARAM.
Macro Definition Documentation¶
define SYN_LZ4_HASH_SIZE¶
LZ4 hash table size (4096 entries = 8 KB)
The documentation for this class was generated from the following file src/syntropic/util/syn_lz4.h