xref: /titanic_53/usr/src/contrib/zlib/deflate.h (revision 64c3d15931c5518f89221f1e36d3015dbb54b9bd)
1ab9e68a2SToomas Soome /* deflate.h -- internal compression state
2*64c3d159SToomas Soome  * Copyright (C) 1995-2018 Jean-loup Gailly
3ab9e68a2SToomas Soome  * For conditions of distribution and use, see copyright notice in zlib.h
4ab9e68a2SToomas Soome  */
5ab9e68a2SToomas Soome 
6ab9e68a2SToomas Soome /* WARNING: this file should *not* be used by applications. It is
7ab9e68a2SToomas Soome    part of the implementation of the compression library and is
8ab9e68a2SToomas Soome    subject to change. Applications should only use zlib.h.
9ab9e68a2SToomas Soome  */
10ab9e68a2SToomas Soome 
11ab9e68a2SToomas Soome #ifndef DEFLATE_H
12ab9e68a2SToomas Soome #define DEFLATE_H
13ab9e68a2SToomas Soome 
14ab9e68a2SToomas Soome #include "zutil.h"
15ab9e68a2SToomas Soome 
16ab9e68a2SToomas Soome /* define NO_GZIP when compiling if you want to disable gzip header and
17ab9e68a2SToomas Soome    trailer creation by deflate().  NO_GZIP would be used to avoid linking in
18ab9e68a2SToomas Soome    the crc code when it is not needed.  For shared libraries, gzip encoding
19ab9e68a2SToomas Soome    should be left enabled. */
20ab9e68a2SToomas Soome #ifndef NO_GZIP
21ab9e68a2SToomas Soome #  define GZIP
22ab9e68a2SToomas Soome #endif
23ab9e68a2SToomas Soome 
24ab9e68a2SToomas Soome /* ===========================================================================
25ab9e68a2SToomas Soome  * Internal compression state.
26ab9e68a2SToomas Soome  */
27ab9e68a2SToomas Soome 
28ab9e68a2SToomas Soome #define LENGTH_CODES 29
29ab9e68a2SToomas Soome /* number of length codes, not counting the special END_BLOCK code */
30ab9e68a2SToomas Soome 
31ab9e68a2SToomas Soome #define LITERALS  256
32ab9e68a2SToomas Soome /* number of literal bytes 0..255 */
33ab9e68a2SToomas Soome 
34ab9e68a2SToomas Soome #define L_CODES (LITERALS+1+LENGTH_CODES)
35ab9e68a2SToomas Soome /* number of Literal or Length codes, including the END_BLOCK code */
36ab9e68a2SToomas Soome 
37ab9e68a2SToomas Soome #define D_CODES   30
38ab9e68a2SToomas Soome /* number of distance codes */
39ab9e68a2SToomas Soome 
40ab9e68a2SToomas Soome #define BL_CODES  19
41ab9e68a2SToomas Soome /* number of codes used to transfer the bit lengths */
42ab9e68a2SToomas Soome 
43ab9e68a2SToomas Soome #define HEAP_SIZE (2*L_CODES+1)
44ab9e68a2SToomas Soome /* maximum heap size */
45ab9e68a2SToomas Soome 
46ab9e68a2SToomas Soome #define MAX_BITS 15
47ab9e68a2SToomas Soome /* All codes must not exceed MAX_BITS bits */
48ab9e68a2SToomas Soome 
49ab9e68a2SToomas Soome #define Buf_size 16
50ab9e68a2SToomas Soome /* size of bit buffer in bi_buf */
51ab9e68a2SToomas Soome 
52ab9e68a2SToomas Soome #define INIT_STATE    42    /* zlib header -> BUSY_STATE */
53ab9e68a2SToomas Soome #ifdef GZIP
54ab9e68a2SToomas Soome #  define GZIP_STATE  57    /* gzip header -> BUSY_STATE | EXTRA_STATE */
55ab9e68a2SToomas Soome #endif
56ab9e68a2SToomas Soome #define EXTRA_STATE   69    /* gzip extra block -> NAME_STATE */
57ab9e68a2SToomas Soome #define NAME_STATE    73    /* gzip file name -> COMMENT_STATE */
58ab9e68a2SToomas Soome #define COMMENT_STATE 91    /* gzip comment -> HCRC_STATE */
59ab9e68a2SToomas Soome #define HCRC_STATE   103    /* gzip header CRC -> BUSY_STATE */
60ab9e68a2SToomas Soome #define BUSY_STATE   113    /* deflate -> FINISH_STATE */
61ab9e68a2SToomas Soome #define FINISH_STATE 666    /* stream complete */
62ab9e68a2SToomas Soome /* Stream status */
63ab9e68a2SToomas Soome 
64ab9e68a2SToomas Soome 
65ab9e68a2SToomas Soome /* Data structure describing a single value and its code string. */
66ab9e68a2SToomas Soome typedef struct ct_data_s {
67ab9e68a2SToomas Soome     union {
68ab9e68a2SToomas Soome         ush  freq;       /* frequency count */
69ab9e68a2SToomas Soome         ush  code;       /* bit string */
70ab9e68a2SToomas Soome     } fc;
71ab9e68a2SToomas Soome     union {
72ab9e68a2SToomas Soome         ush  dad;        /* father node in Huffman tree */
73ab9e68a2SToomas Soome         ush  len;        /* length of bit string */
74ab9e68a2SToomas Soome     } dl;
75ab9e68a2SToomas Soome } FAR ct_data;
76ab9e68a2SToomas Soome 
77ab9e68a2SToomas Soome #define Freq fc.freq
78ab9e68a2SToomas Soome #define Code fc.code
79ab9e68a2SToomas Soome #define Dad  dl.dad
80ab9e68a2SToomas Soome #define Len  dl.len
81ab9e68a2SToomas Soome 
82ab9e68a2SToomas Soome typedef struct static_tree_desc_s  static_tree_desc;
83ab9e68a2SToomas Soome 
84ab9e68a2SToomas Soome typedef struct tree_desc_s {
85ab9e68a2SToomas Soome     ct_data *dyn_tree;           /* the dynamic tree */
86ab9e68a2SToomas Soome     int     max_code;            /* largest code with non zero frequency */
87ab9e68a2SToomas Soome     const static_tree_desc *stat_desc;  /* the corresponding static tree */
88ab9e68a2SToomas Soome } FAR tree_desc;
89ab9e68a2SToomas Soome 
90ab9e68a2SToomas Soome typedef ush Pos;
91ab9e68a2SToomas Soome typedef Pos FAR Posf;
92ab9e68a2SToomas Soome typedef unsigned IPos;
93ab9e68a2SToomas Soome 
94ab9e68a2SToomas Soome /* A Pos is an index in the character window. We use short instead of int to
95ab9e68a2SToomas Soome  * save space in the various tables. IPos is used only for parameter passing.
96ab9e68a2SToomas Soome  */
97ab9e68a2SToomas Soome 
98ab9e68a2SToomas Soome typedef struct internal_state {
99ab9e68a2SToomas Soome     z_streamp strm;      /* pointer back to this zlib stream */
100ab9e68a2SToomas Soome     int   status;        /* as the name implies */
101ab9e68a2SToomas Soome     Bytef *pending_buf;  /* output still pending */
102ab9e68a2SToomas Soome     ulg   pending_buf_size; /* size of pending_buf */
103ab9e68a2SToomas Soome     Bytef *pending_out;  /* next pending byte to output to the stream */
104ab9e68a2SToomas Soome     ulg   pending;       /* nb of bytes in the pending buffer */
105ab9e68a2SToomas Soome     int   wrap;          /* bit 0 true for zlib, bit 1 true for gzip */
106ab9e68a2SToomas Soome     gz_headerp  gzhead;  /* gzip header information to write */
107ab9e68a2SToomas Soome     ulg   gzindex;       /* where in extra, name, or comment */
108ab9e68a2SToomas Soome     Byte  method;        /* can only be DEFLATED */
109ab9e68a2SToomas Soome     int   last_flush;    /* value of flush param for previous deflate call */
110ab9e68a2SToomas Soome 
111ab9e68a2SToomas Soome                 /* used by deflate.c: */
112ab9e68a2SToomas Soome 
113ab9e68a2SToomas Soome     uInt  w_size;        /* LZ77 window size (32K by default) */
114ab9e68a2SToomas Soome     uInt  w_bits;        /* log2(w_size)  (8..16) */
115ab9e68a2SToomas Soome     uInt  w_mask;        /* w_size - 1 */
116ab9e68a2SToomas Soome 
117ab9e68a2SToomas Soome     Bytef *window;
118ab9e68a2SToomas Soome     /* Sliding window. Input bytes are read into the second half of the window,
119ab9e68a2SToomas Soome      * and move to the first half later to keep a dictionary of at least wSize
120ab9e68a2SToomas Soome      * bytes. With this organization, matches are limited to a distance of
121ab9e68a2SToomas Soome      * wSize-MAX_MATCH bytes, but this ensures that IO is always
122ab9e68a2SToomas Soome      * performed with a length multiple of the block size. Also, it limits
123ab9e68a2SToomas Soome      * the window size to 64K, which is quite useful on MSDOS.
124ab9e68a2SToomas Soome      * To do: use the user input buffer as sliding window.
125ab9e68a2SToomas Soome      */
126ab9e68a2SToomas Soome 
127ab9e68a2SToomas Soome     ulg window_size;
128ab9e68a2SToomas Soome     /* Actual size of window: 2*wSize, except when the user input buffer
129ab9e68a2SToomas Soome      * is directly used as sliding window.
130ab9e68a2SToomas Soome      */
131ab9e68a2SToomas Soome 
132ab9e68a2SToomas Soome     Posf *prev;
133ab9e68a2SToomas Soome     /* Link to older string with same hash index. To limit the size of this
134ab9e68a2SToomas Soome      * array to 64K, this link is maintained only for the last 32K strings.
135ab9e68a2SToomas Soome      * An index in this array is thus a window index modulo 32K.
136ab9e68a2SToomas Soome      */
137ab9e68a2SToomas Soome 
138ab9e68a2SToomas Soome     Posf *head; /* Heads of the hash chains or NIL. */
139ab9e68a2SToomas Soome 
140ab9e68a2SToomas Soome     uInt  ins_h;          /* hash index of string to be inserted */
141ab9e68a2SToomas Soome     uInt  hash_size;      /* number of elements in hash table */
142ab9e68a2SToomas Soome     uInt  hash_bits;      /* log2(hash_size) */
143ab9e68a2SToomas Soome     uInt  hash_mask;      /* hash_size-1 */
144ab9e68a2SToomas Soome 
145ab9e68a2SToomas Soome     uInt  hash_shift;
146ab9e68a2SToomas Soome     /* Number of bits by which ins_h must be shifted at each input
147ab9e68a2SToomas Soome      * step. It must be such that after MIN_MATCH steps, the oldest
148ab9e68a2SToomas Soome      * byte no longer takes part in the hash key, that is:
149ab9e68a2SToomas Soome      *   hash_shift * MIN_MATCH >= hash_bits
150ab9e68a2SToomas Soome      */
151ab9e68a2SToomas Soome 
152ab9e68a2SToomas Soome     long block_start;
153ab9e68a2SToomas Soome     /* Window position at the beginning of the current output block. Gets
154ab9e68a2SToomas Soome      * negative when the window is moved backwards.
155ab9e68a2SToomas Soome      */
156ab9e68a2SToomas Soome 
157ab9e68a2SToomas Soome     uInt match_length;           /* length of best match */
158ab9e68a2SToomas Soome     IPos prev_match;             /* previous match */
159ab9e68a2SToomas Soome     int match_available;         /* set if previous match exists */
160ab9e68a2SToomas Soome     uInt strstart;               /* start of string to insert */
161ab9e68a2SToomas Soome     uInt match_start;            /* start of matching string */
162ab9e68a2SToomas Soome     uInt lookahead;              /* number of valid bytes ahead in window */
163ab9e68a2SToomas Soome 
164ab9e68a2SToomas Soome     uInt prev_length;
165ab9e68a2SToomas Soome     /* Length of the best match at previous step. Matches not greater than this
166ab9e68a2SToomas Soome      * are discarded. This is used in the lazy match evaluation.
167ab9e68a2SToomas Soome      */
168ab9e68a2SToomas Soome 
169ab9e68a2SToomas Soome     uInt max_chain_length;
170ab9e68a2SToomas Soome     /* To speed up deflation, hash chains are never searched beyond this
171ab9e68a2SToomas Soome      * length.  A higher limit improves compression ratio but degrades the
172ab9e68a2SToomas Soome      * speed.
173ab9e68a2SToomas Soome      */
174ab9e68a2SToomas Soome 
175ab9e68a2SToomas Soome     uInt max_lazy_match;
176ab9e68a2SToomas Soome     /* Attempt to find a better match only when the current match is strictly
177ab9e68a2SToomas Soome      * smaller than this value. This mechanism is used only for compression
178ab9e68a2SToomas Soome      * levels >= 4.
179ab9e68a2SToomas Soome      */
180ab9e68a2SToomas Soome #   define max_insert_length  max_lazy_match
181ab9e68a2SToomas Soome     /* Insert new strings in the hash table only if the match length is not
182ab9e68a2SToomas Soome      * greater than this length. This saves time but degrades compression.
183ab9e68a2SToomas Soome      * max_insert_length is used only for compression levels <= 3.
184ab9e68a2SToomas Soome      */
185ab9e68a2SToomas Soome 
186ab9e68a2SToomas Soome     int level;    /* compression level (1..9) */
187ab9e68a2SToomas Soome     int strategy; /* favor or force Huffman coding*/
188ab9e68a2SToomas Soome 
189ab9e68a2SToomas Soome     uInt good_match;
190ab9e68a2SToomas Soome     /* Use a faster search when the previous match is longer than this */
191ab9e68a2SToomas Soome 
192ab9e68a2SToomas Soome     int nice_match; /* Stop searching when current match exceeds this */
193ab9e68a2SToomas Soome 
194ab9e68a2SToomas Soome                 /* used by trees.c: */
195ab9e68a2SToomas Soome     /* Didn't use ct_data typedef below to suppress compiler warning */
196ab9e68a2SToomas Soome     struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */
197ab9e68a2SToomas Soome     struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
198ab9e68a2SToomas Soome     struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */
199ab9e68a2SToomas Soome 
200ab9e68a2SToomas Soome     struct tree_desc_s l_desc;               /* desc. for literal tree */
201ab9e68a2SToomas Soome     struct tree_desc_s d_desc;               /* desc. for distance tree */
202ab9e68a2SToomas Soome     struct tree_desc_s bl_desc;              /* desc. for bit length tree */
203ab9e68a2SToomas Soome 
204ab9e68a2SToomas Soome     ush bl_count[MAX_BITS+1];
205ab9e68a2SToomas Soome     /* number of codes at each bit length for an optimal tree */
206ab9e68a2SToomas Soome 
207ab9e68a2SToomas Soome     int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */
208ab9e68a2SToomas Soome     int heap_len;               /* number of elements in the heap */
209ab9e68a2SToomas Soome     int heap_max;               /* element of largest frequency */
210ab9e68a2SToomas Soome     /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
211ab9e68a2SToomas Soome      * The same heap array is used to build all trees.
212ab9e68a2SToomas Soome      */
213ab9e68a2SToomas Soome 
214ab9e68a2SToomas Soome     uch depth[2*L_CODES+1];
215ab9e68a2SToomas Soome     /* Depth of each subtree used as tie breaker for trees of equal frequency
216ab9e68a2SToomas Soome      */
217ab9e68a2SToomas Soome 
218*64c3d159SToomas Soome     uchf *sym_buf;        /* buffer for distances and literals/lengths */
219ab9e68a2SToomas Soome 
220ab9e68a2SToomas Soome     uInt  lit_bufsize;
221ab9e68a2SToomas Soome     /* Size of match buffer for literals/lengths.  There are 4 reasons for
222ab9e68a2SToomas Soome      * limiting lit_bufsize to 64K:
223ab9e68a2SToomas Soome      *   - frequencies can be kept in 16 bit counters
224ab9e68a2SToomas Soome      *   - if compression is not successful for the first block, all input
225ab9e68a2SToomas Soome      *     data is still in the window so we can still emit a stored block even
226ab9e68a2SToomas Soome      *     when input comes from standard input.  (This can also be done for
227ab9e68a2SToomas Soome      *     all blocks if lit_bufsize is not greater than 32K.)
228ab9e68a2SToomas Soome      *   - if compression is not successful for a file smaller than 64K, we can
229ab9e68a2SToomas Soome      *     even emit a stored file instead of a stored block (saving 5 bytes).
230ab9e68a2SToomas Soome      *     This is applicable only for zip (not gzip or zlib).
231ab9e68a2SToomas Soome      *   - creating new Huffman trees less frequently may not provide fast
232ab9e68a2SToomas Soome      *     adaptation to changes in the input data statistics. (Take for
233ab9e68a2SToomas Soome      *     example a binary file with poorly compressible code followed by
234ab9e68a2SToomas Soome      *     a highly compressible string table.) Smaller buffer sizes give
235ab9e68a2SToomas Soome      *     fast adaptation but have of course the overhead of transmitting
236ab9e68a2SToomas Soome      *     trees more frequently.
237ab9e68a2SToomas Soome      *   - I can't count above 4
238ab9e68a2SToomas Soome      */
239ab9e68a2SToomas Soome 
240*64c3d159SToomas Soome     uInt sym_next;      /* running index in sym_buf */
241*64c3d159SToomas Soome     uInt sym_end;       /* symbol table full when sym_next reaches this */
242ab9e68a2SToomas Soome 
243ab9e68a2SToomas Soome     ulg opt_len;        /* bit length of current block with optimal trees */
244ab9e68a2SToomas Soome     ulg static_len;     /* bit length of current block with static trees */
245ab9e68a2SToomas Soome     uInt matches;       /* number of string matches in current block */
246ab9e68a2SToomas Soome     uInt insert;        /* bytes at end of window left to insert */
247ab9e68a2SToomas Soome 
248ab9e68a2SToomas Soome #ifdef ZLIB_DEBUG
249ab9e68a2SToomas Soome     ulg compressed_len; /* total bit length of compressed file mod 2^32 */
250ab9e68a2SToomas Soome     ulg bits_sent;      /* bit length of compressed data sent mod 2^32 */
251ab9e68a2SToomas Soome #endif
252ab9e68a2SToomas Soome 
253ab9e68a2SToomas Soome     ush bi_buf;
254ab9e68a2SToomas Soome     /* Output buffer. bits are inserted starting at the bottom (least
255ab9e68a2SToomas Soome      * significant bits).
256ab9e68a2SToomas Soome      */
257ab9e68a2SToomas Soome     int bi_valid;
258ab9e68a2SToomas Soome     /* Number of valid bits in bi_buf.  All bits above the last valid bit
259ab9e68a2SToomas Soome      * are always zero.
260ab9e68a2SToomas Soome      */
261ab9e68a2SToomas Soome 
262ab9e68a2SToomas Soome     ulg high_water;
263ab9e68a2SToomas Soome     /* High water mark offset in window for initialized bytes -- bytes above
264ab9e68a2SToomas Soome      * this are set to zero in order to avoid memory check warnings when
265ab9e68a2SToomas Soome      * longest match routines access bytes past the input.  This is then
266ab9e68a2SToomas Soome      * updated to the new high water mark.
267ab9e68a2SToomas Soome      */
268ab9e68a2SToomas Soome 
269ab9e68a2SToomas Soome } FAR deflate_state;
270ab9e68a2SToomas Soome 
271ab9e68a2SToomas Soome /* Output a byte on the stream.
272ab9e68a2SToomas Soome  * IN assertion: there is enough room in pending_buf.
273ab9e68a2SToomas Soome  */
274ab9e68a2SToomas Soome #define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}
275ab9e68a2SToomas Soome 
276ab9e68a2SToomas Soome 
277ab9e68a2SToomas Soome #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
278ab9e68a2SToomas Soome /* Minimum amount of lookahead, except at the end of the input file.
279ab9e68a2SToomas Soome  * See deflate.c for comments about the MIN_MATCH+1.
280ab9e68a2SToomas Soome  */
281ab9e68a2SToomas Soome 
282ab9e68a2SToomas Soome #define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
283ab9e68a2SToomas Soome /* In order to simplify the code, particularly on 16 bit machines, match
284ab9e68a2SToomas Soome  * distances are limited to MAX_DIST instead of WSIZE.
285ab9e68a2SToomas Soome  */
286ab9e68a2SToomas Soome 
287ab9e68a2SToomas Soome #define WIN_INIT MAX_MATCH
288ab9e68a2SToomas Soome /* Number of bytes after end of data in window to initialize in order to avoid
289ab9e68a2SToomas Soome    memory checker errors from longest match routines */
290ab9e68a2SToomas Soome 
291ab9e68a2SToomas Soome         /* in trees.c */
292ab9e68a2SToomas Soome void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
293ab9e68a2SToomas Soome int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
294ab9e68a2SToomas Soome void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
295ab9e68a2SToomas Soome                         ulg stored_len, int last));
296ab9e68a2SToomas Soome void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
297ab9e68a2SToomas Soome void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
298ab9e68a2SToomas Soome void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
299ab9e68a2SToomas Soome                         ulg stored_len, int last));
300ab9e68a2SToomas Soome 
301ab9e68a2SToomas Soome #define d_code(dist) \
302ab9e68a2SToomas Soome    ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
303ab9e68a2SToomas Soome /* Mapping from a distance to a distance code. dist is the distance - 1 and
304ab9e68a2SToomas Soome  * must not have side effects. _dist_code[256] and _dist_code[257] are never
305ab9e68a2SToomas Soome  * used.
306ab9e68a2SToomas Soome  */
307ab9e68a2SToomas Soome 
308ab9e68a2SToomas Soome #ifndef ZLIB_DEBUG
309ab9e68a2SToomas Soome /* Inline versions of _tr_tally for speed: */
310ab9e68a2SToomas Soome 
311ab9e68a2SToomas Soome #if defined(GEN_TREES_H) || !defined(STDC)
312ab9e68a2SToomas Soome   extern uch ZLIB_INTERNAL _length_code[];
313ab9e68a2SToomas Soome   extern uch ZLIB_INTERNAL _dist_code[];
314ab9e68a2SToomas Soome #else
315ab9e68a2SToomas Soome   extern const uch ZLIB_INTERNAL _length_code[];
316ab9e68a2SToomas Soome   extern const uch ZLIB_INTERNAL _dist_code[];
317ab9e68a2SToomas Soome #endif
318ab9e68a2SToomas Soome 
319ab9e68a2SToomas Soome # define _tr_tally_lit(s, c, flush) \
320ab9e68a2SToomas Soome   { uch cc = (c); \
321*64c3d159SToomas Soome     s->sym_buf[s->sym_next++] = 0; \
322*64c3d159SToomas Soome     s->sym_buf[s->sym_next++] = 0; \
323*64c3d159SToomas Soome     s->sym_buf[s->sym_next++] = cc; \
324ab9e68a2SToomas Soome     s->dyn_ltree[cc].Freq++; \
325*64c3d159SToomas Soome     flush = (s->sym_next == s->sym_end); \
326ab9e68a2SToomas Soome    }
327ab9e68a2SToomas Soome # define _tr_tally_dist(s, distance, length, flush) \
328ab9e68a2SToomas Soome   { uch len = (uch)(length); \
329ab9e68a2SToomas Soome     ush dist = (ush)(distance); \
330*64c3d159SToomas Soome     s->sym_buf[s->sym_next++] = dist; \
331*64c3d159SToomas Soome     s->sym_buf[s->sym_next++] = dist >> 8; \
332*64c3d159SToomas Soome     s->sym_buf[s->sym_next++] = len; \
333ab9e68a2SToomas Soome     dist--; \
334ab9e68a2SToomas Soome     s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
335ab9e68a2SToomas Soome     s->dyn_dtree[d_code(dist)].Freq++; \
336*64c3d159SToomas Soome     flush = (s->sym_next == s->sym_end); \
337ab9e68a2SToomas Soome   }
338ab9e68a2SToomas Soome #else
339ab9e68a2SToomas Soome # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
340ab9e68a2SToomas Soome # define _tr_tally_dist(s, distance, length, flush) \
341ab9e68a2SToomas Soome               flush = _tr_tally(s, distance, length)
342ab9e68a2SToomas Soome #endif
343ab9e68a2SToomas Soome 
344ab9e68a2SToomas Soome #endif /* DEFLATE_H */
345