ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Committer:
TMBOY
Date:
Tue Jul 18 16:54:45 2017 +0800
Revision:
47:9e361da97763
?

Who changed what in which revision?

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