URI: 
       twhack.h - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       twhack.h (966B)
       ---
            1 typedef struct Whack                Whack;
            2 typedef struct Unwhack                Unwhack;
            3 
            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 */
            9 
           10         HashLog                = 14,
           11         HashSize        = 1<<HashLog,
           12         HashMask        = HashSize - 1,
           13 
           14         MinMatch        = 3,                /* shortest match possible */
           15 
           16         MinDecode        = 8,                /* minimum bits to decode a match or lit; >= 8 */
           17 
           18         MaxSeqMask        = 8,                /* number of bits in coding block mask */
           19         MaxSeqStart        = 256                /* max offset of initial coding block */
           20 };
           21 
           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 };
           29 
           30 struct Unwhack
           31 {
           32         char                err[WhackErrLen];
           33 };
           34 
           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);
           39 
           40 int        whackblock(uchar *dst, uchar *src, int ssize);