Blame deps/zlib/inftrees.h

Packit Service 20376f
/* inftrees.h -- header to use inftrees.c
Packit Service 20376f
 * Copyright (C) 1995-2005, 2010 Mark Adler
Packit Service 20376f
 * For conditions of distribution and use, see copyright notice in zlib.h
Packit Service 20376f
 */
Packit Service 20376f
Packit Service 20376f
/* WARNING: this file should *not* be used by applications. It is
Packit Service 20376f
   part of the implementation of the compression library and is
Packit Service 20376f
   subject to change. Applications should only use zlib.h.
Packit Service 20376f
 */
Packit Service 20376f
Packit Service 20376f
/* Structure for decoding tables.  Each entry provides either the
Packit Service 20376f
   information needed to do the operation requested by the code that
Packit Service 20376f
   indexed that table entry, or it provides a pointer to another
Packit Service 20376f
   table that indexes more bits of the code.  op indicates whether
Packit Service 20376f
   the entry is a pointer to another table, a literal, a length or
Packit Service 20376f
   distance, an end-of-block, or an invalid code.  For a table
Packit Service 20376f
   pointer, the low four bits of op is the number of index bits of
Packit Service 20376f
   that table.  For a length or distance, the low four bits of op
Packit Service 20376f
   is the number of extra bits to get after the code.  bits is
Packit Service 20376f
   the number of bits in this code or part of the code to drop off
Packit Service 20376f
   of the bit buffer.  val is the actual byte to output in the case
Packit Service 20376f
   of a literal, the base length or distance, or the offset from
Packit Service 20376f
   the current table to the next table.  Each entry is four bytes. */
Packit Service 20376f
typedef struct {
Packit Service 20376f
    unsigned char op;           /* operation, extra bits, table bits */
Packit Service 20376f
    unsigned char bits;         /* bits in this part of the code */
Packit Service 20376f
    unsigned short val;         /* offset in table or code value */
Packit Service 20376f
} code;
Packit Service 20376f
Packit Service 20376f
/* op values as set by inflate_table():
Packit Service 20376f
    00000000 - literal
Packit Service 20376f
    0000tttt - table link, tttt != 0 is the number of table index bits
Packit Service 20376f
    0001eeee - length or distance, eeee is the number of extra bits
Packit Service 20376f
    01100000 - end of block
Packit Service 20376f
    01000000 - invalid code
Packit Service 20376f
 */
Packit Service 20376f
Packit Service 20376f
/* Maximum size of the dynamic table.  The maximum number of code structures is
Packit Service 20376f
   1444, which is the sum of 852 for literal/length codes and 592 for distance
Packit Service 20376f
   codes.  These values were found by exhaustive searches using the program
Packit Service 20376f
   examples/enough.c found in the zlib distribtution.  The arguments to that
Packit Service 20376f
   program are the number of symbols, the initial root table size, and the
Packit Service 20376f
   maximum bit length of a code.  "enough 286 9 15" for literal/length codes
Packit Service 20376f
   returns returns 852, and "enough 30 6 15" for distance codes returns 592.
Packit Service 20376f
   The initial root table size (9 or 6) is found in the fifth argument of the
Packit Service 20376f
   inflate_table() calls in inflate.c and infback.c.  If the root table size is
Packit Service 20376f
   changed, then these maximum sizes would be need to be recalculated and
Packit Service 20376f
   updated. */
Packit Service 20376f
#define ENOUGH_LENS 852
Packit Service 20376f
#define ENOUGH_DISTS 592
Packit Service 20376f
#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
Packit Service 20376f
Packit Service 20376f
/* Type of code to build for inflate_table() */
Packit Service 20376f
typedef enum {
Packit Service 20376f
    CODES,
Packit Service 20376f
    LENS,
Packit Service 20376f
    DISTS
Packit Service 20376f
} codetype;
Packit Service 20376f
Packit Service 20376f
int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
Packit Service 20376f
                             unsigned codes, code FAR * FAR *table,
Packit Service 20376f
                             unsigned FAR *bits, unsigned short FAR *work));