compressBlockFast

private fnsize_t compressBlockFast(const(ubyte) * src, size_t srcLen, ubyte * outBuf, size_t outCap, int level, uint * ht = null, size_t htSize = 0, uint htBits = 0) @trusted @nogc nothrow

Compress a single block using the fast pointer-based path.

This function performs LZO1X-style compression entirely with raw pointers and malloc/free, avoiding all GC allocations. It is marked @trusted @nogc nothrow so it can be called from performance-sensitive contexts.

The caller is responsible for providing a sufficiently large output buffer. A safe upper bound is srcLen + srcLen / 16 + 64.

When ht is supplied the caller owns the hash table and it is

not freed by this function; it is only reset with memset.

When ht is null the function allocates and frees a hash table internally.

Parameters

srcPointer to the uncompressed source data.
srcLenNumber of bytes at src.
outBufPointer to the output buffer.
outCapCapacity of outBuf in bytes.
levelCompression level (0-9).
htOptional externally-owned hash table. If null, one is allocated and freed internally.
htSizeNumber of entries in the externally-owned hash table. Ignored when ht is null.
htBitsNumber of hash bits for the external table. Ignored when ht is null.

Returns

The number of bytes written to outBuf.

See Also

compressBlock