Alchemy
Loading...
Searching...
No Matches

lzpack.h

Go to the documentation of this file.
1#ifndef ALCHEMY_LZPACK_H
2#define ALCHEMY_LZPACK_H
3
4/// @file
5/// The LZ packer's work: hash chains over a 1024-byte window, one chain per
6/// byte value, and the output it is building. It borrows gFlash_Handler3 as
7/// its work pointer.
8
9#include "edition.h"
10#include "types.h"
11#include "static_assert.h"
13
14/// A position of the LZ packer's window in the chain of the byte value it
15/// holds.
16struct LzPackNode {
17 struct LzPackNode *next; ///< Next node with the same value.
18 struct LzPackNode *prev; ///< Previous node, or the bucket field at the head.
20};
21
22/// The LZ packer's work: a node per window position, a chain head per byte
23/// value, the byte at each position, the best match and the output.
24struct LzPackWork {
25 struct LzPackNode nodes[0x400];
26 struct LzPackNode *bucket[0x100];
30 u8 outBuf[0x24];
37};
38
39STATIC_ASSERT(sizeof(struct LzPackNode) == 12);
40STATIC_ASSERT(sizeof(struct LzPackWork) == 0x4444);
41STATIC_ASSERT(offsetof(struct LzPackWork, bucket) == 0x3000);
42STATIC_ASSERT(offsetof(struct LzPackWork, inputCursor) == 0x4438);
43
44#endif
The sound driver's command masks, cue controls and the routines and globals it shares with the engine...
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
STATIC_ASSERT, a compile-time check that emits nothing.
#define STATIC_ASSERT(condition)
C89 permits repeated extern declarations of the same array.
#define offsetof(type, member)
Definition stddef.h:19
A position of the LZ packer's window in the chain of the byte value it holds.
Definition lzpack.h:16
s32 slot
Definition lzpack.h:19
struct LzPackNode * prev
Previous node, or the bucket field at the head.
Definition lzpack.h:18
struct LzPackNode * next
Next node with the same value.
Definition lzpack.h:17
The LZ packer's work: a node per window position, a chain head per byte value, the byte at each posit...
Definition lzpack.h:24
u8 outBuf[0x24]
Definition lzpack.h:30
s32 matchOffset
Definition lzpack.h:31
s32 outCnt
Definition lzpack.h:29
s32 outTotal
Definition lzpack.h:35
s32 flagMask
Definition lzpack.h:27
s32 bucketBySlot[0x400]
Definition lzpack.h:28
struct LzPackNode * bucket[0x100]
Definition lzpack.h:26
s32 pos
Definition lzpack.h:33
s32 matchLen
Definition lzpack.h:32
u32 inputCursor
Definition lzpack.h:34
u32 inputLimit
Definition lzpack.h:36
struct LzPackNode nodes[0x400]
Definition lzpack.h:25
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
unsigned char u8
Definition types.h:11