Blame


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