Blame


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