Skip to Content
The Alchemy Project

include/field/lucky_wheels_lzpack.h

The LZ packer's state: hash chains over a 1024-byte window, one chain per byte value, and the output it is building.

Included by lucky_wheels.c.

Structures

NameDescription
structLZ_PACK_NODEA position of the LZ packer's window in the chain of the byte value it holds.
structLZ_PACK_STATEThe LZ packer's state: a node per window position, a chain head per byte value, the byte at each position, the best match and the output.

Macros

NameDescription
#defineLzPackStateWork (*(LZ_PACK_STATE **)&WaitForFlashWriteWork)The packer has no metatile of its own for its state pointer: it borrows the SDK's flash library's WaitForFlashWriteWork (sdk/flash_data.h), which IdentifyFlash sets again before the flash code reads it.

Functions

NameDescription
voidfdLZPackResetSlotBuckets (void)Empties the LZ packer's hash chains and numbers its window nodes.
voidfdLZPackInsertSlotNode (Sint32 slot)Adds window position index to the chain of the byte it holds.
voidfdLZPackRemoveSlotNode (Sint32 slot)Removes window position slot from its chain.
voidfdLZPackConsumeSlotBytes (Sint32 start, Sint32 count, const Uint8 *input)Reads count more input bytes into the window from position start, dropping the bytes they replace from their chains; past the end of the input the positions are marked empty (-1).
voidfdLZPackCopyBufferedBytes (Uint8 *dest)Appends the finished group (a flag byte and up to eight items) to the output.
Sint32fdLZPackPackStream (const Uint8 *input, Uint8 *dest, Sint32 size)Unused: packs size bytes of input into dest with a small LZ scheme and returns the packed size.

Description

The LZ packer's state: hash chains over a 1024-byte window, one chain per byte value, and the output it is building.

Macros in detail

LzPackStateWork

#define LzPackStateWork (*(LZ_PACK_STATE **)&WaitForFlashWriteWork)

The packer has no metatile of its own for its state pointer: it borrows the SDK's flash library's WaitForFlashWriteWork (sdk/flash_data.h), which IdentifyFlash sets again before the flash code reads it.

Referenced by fdLZPackConsumeSlotBytes(), fdLZPackCopyBufferedBytes(), fdLZPackFindWindowMatch(), fdLZPackInsertSlotNode(), fdLZPackPackStream(), fdLZPackRemoveSlotNode() and fdLZPackResetSlotBuckets().

Definition at line 50 of file lucky_wheels_lzpack.h.