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.
#include "edition.h"#include "types.h"#include "static_assert.h"#include "sdk/flash_data.h"
Included by lucky_wheels.c.
Structures
| Name | Description | |
|---|---|---|
struct | LZ_PACK_NODE | A position of the LZ packer's window in the chain of the byte value it holds. |
struct | LZ_PACK_STATE | The 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
| Name | Description | |
|---|---|---|
#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. |
Functions
| Name | Description | |
|---|---|---|
void | fdLZPackResetSlotBuckets (void) | Empties the LZ packer's hash chains and numbers its window nodes. |
void | fdLZPackInsertSlotNode (Sint32 slot) | Adds window position index to the chain of the byte it holds. |
void | fdLZPackRemoveSlotNode (Sint32 slot) | Removes window position slot from its chain. |
void | fdLZPackConsumeSlotBytes (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). |
void | fdLZPackCopyBufferedBytes (Uint8 *dest) | Appends the finished group (a flag byte and up to eight items) to the output. |
Sint32 | fdLZPackPackStream (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.