encodeLength

private fnvoid encodeLength(ref ubyte * p, size_t length) nothrow @nogc

Encode a length value using LZ4's variable-length encoding scheme.

LZ4 encodes lengths that exceed the 4-bit token capacity (15) using extension bytes. If the initial 4-bit value is 15, additional bytes follow: each byte with value 255 adds 255 to the length, and a final byte with value < 255 terminates the sequence.

This function emits the extension bytes only (not the initial 4-bit value in the token). The caller is responsible for setting the token nibble to 15 when length >= 15.

Parameters

pPointer to current write position; advanced past bytes written.
lengthThe length value to encode (already reduced by the token nibble).