Blob


1 typedef struct Whack Whack;
2 typedef struct Unwhack Unwhack;
4 enum
5 {
6 WhackStats = 8,
7 WhackErrLen = 64, /* max length of error message from thwack or unthwack */
8 WhackMaxOff = 16*1024, /* max allowed offset */
10 HashLog = 14,
11 HashSize = 1<<HashLog,
12 HashMask = HashSize - 1,
14 MinMatch = 3, /* shortest match possible */
16 MinDecode = 8, /* minimum bits to decode a match or lit; >= 8 */
18 MaxSeqMask = 8, /* number of bits in coding block mask */
19 MaxSeqStart = 256 /* max offset of initial coding block */
20 };
22 struct Whack
23 {
24 ushort begin; /* time of first byte in hash */
25 ushort hash[HashSize];
26 ushort next[WhackMaxOff];
27 uchar *data;
28 };
30 struct Unwhack
31 {
32 char err[WhackErrLen];
33 };
35 void whackinit(Whack*, int level);
36 void unwhackinit(Unwhack*);
37 int whack(Whack*, uchar *dst, uchar *src, int nsrc, ulong stats[WhackStats]);
38 int unwhack(Unwhack*, uchar *dst, int ndst, uchar *src, int nsrc);
40 int whackblock(uchar *dst, uchar *src, int ssize);