1 typedef struct Thwack Thwack;
2 typedef struct Unthwack Unthwack;
3 typedef struct ThwBlock ThwBlock;
4 typedef struct UnthwBlock UnthwBlock;
9 ThwMaxBlock = 1600, /* max size of compressible block */
12 HashSize = 1<<HashLog,
13 HashMask = HashSize - 1,
15 MinMatch = 3, /* shortest match possible */
20 MinDecode = 8, /* minimum bits to decode a match or lit; >= 8 */
22 EWinBlocks = 22, /* blocks held in encoder window */
23 DWinBlocks = 32, /* blocks held in decoder window */
24 CompBlocks = 10, /* max blocks used to encode data */
26 MaxSeqMask = 8, /* number of bits in coding block mask */
27 MaxSeqStart = 256 /* max offset of initial coding block */
32 ulong seq; /* sequence number for this data */
33 uchar acked; /* ok to use this block; the decoder has it */
34 ushort begin; /* time of first byte in hash */
35 uchar *edata; /* last byte of valid data */
36 ushort maxoff; /* time of last valid hash entry */
43 int slot; /* next block to use */
44 ThwBlock blocks[EWinBlocks];
45 ushort hash[EWinBlocks][HashSize];
46 uchar data[EWinBlocks][ThwMaxBlock];
51 ulong seq; /* sequence number for this data */
52 ushort maxoff; /* valid data in each block */
58 int slot; /* next block to use */
59 UnthwBlock blocks[DWinBlocks];
60 uchar data[DWinBlocks][ThwMaxBlock];
63 void thwackinit(Thwack*);
64 void unthwackinit(Unthwack*);
65 int thwack(Thwack*, uchar *dst, uchar *src, int nsrc, ulong seq, ulong stats[ThwStats]);
66 void thwackack(Thwack*, ulong seq, ulong mask);
67 int unthwack(Unthwack*, uchar *dst, int ndst, uchar *src, int nsrc, ulong seq);
68 ulong unthwackstate(Unthwack *ut, uchar *mask);