lemon-project-template-glpk

annotate deps/glpk/src/zlib/inftrees.h @ 9:33de93886c88

Import GLPK 4.47
author Alpar Juttner <alpar@cs.elte.hu>
date Sun, 06 Nov 2011 20:59:10 +0100
parents
children
rev   line source
alpar@9 1 /* inftrees.h -- header to use inftrees.c
alpar@9 2 * Copyright (C) 1995-2005, 2010 Mark Adler
alpar@9 3 * For conditions of distribution and use, see copyright notice in zlib.h
alpar@9 4 */
alpar@9 5
alpar@9 6 /* WARNING: this file should *not* be used by applications. It is
alpar@9 7 part of the implementation of the compression library and is
alpar@9 8 subject to change. Applications should only use zlib.h.
alpar@9 9 */
alpar@9 10
alpar@9 11 /* Structure for decoding tables. Each entry provides either the
alpar@9 12 information needed to do the operation requested by the code that
alpar@9 13 indexed that table entry, or it provides a pointer to another
alpar@9 14 table that indexes more bits of the code. op indicates whether
alpar@9 15 the entry is a pointer to another table, a literal, a length or
alpar@9 16 distance, an end-of-block, or an invalid code. For a table
alpar@9 17 pointer, the low four bits of op is the number of index bits of
alpar@9 18 that table. For a length or distance, the low four bits of op
alpar@9 19 is the number of extra bits to get after the code. bits is
alpar@9 20 the number of bits in this code or part of the code to drop off
alpar@9 21 of the bit buffer. val is the actual byte to output in the case
alpar@9 22 of a literal, the base length or distance, or the offset from
alpar@9 23 the current table to the next table. Each entry is four bytes. */
alpar@9 24 typedef struct {
alpar@9 25 unsigned char op; /* operation, extra bits, table bits */
alpar@9 26 unsigned char bits; /* bits in this part of the code */
alpar@9 27 unsigned short val; /* offset in table or code value */
alpar@9 28 } code;
alpar@9 29
alpar@9 30 /* op values as set by inflate_table():
alpar@9 31 00000000 - literal
alpar@9 32 0000tttt - table link, tttt != 0 is the number of table index bits
alpar@9 33 0001eeee - length or distance, eeee is the number of extra bits
alpar@9 34 01100000 - end of block
alpar@9 35 01000000 - invalid code
alpar@9 36 */
alpar@9 37
alpar@9 38 /* Maximum size of the dynamic table. The maximum number of code structures is
alpar@9 39 1444, which is the sum of 852 for literal/length codes and 592 for distance
alpar@9 40 codes. These values were found by exhaustive searches using the program
alpar@9 41 examples/enough.c found in the zlib distribtution. The arguments to that
alpar@9 42 program are the number of symbols, the initial root table size, and the
alpar@9 43 maximum bit length of a code. "enough 286 9 15" for literal/length codes
alpar@9 44 returns returns 852, and "enough 30 6 15" for distance codes returns 592.
alpar@9 45 The initial root table size (9 or 6) is found in the fifth argument of the
alpar@9 46 inflate_table() calls in inflate.c and infback.c. If the root table size is
alpar@9 47 changed, then these maximum sizes would be need to be recalculated and
alpar@9 48 updated. */
alpar@9 49 #define ENOUGH_LENS 852
alpar@9 50 #define ENOUGH_DISTS 592
alpar@9 51 #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
alpar@9 52
alpar@9 53 /* Type of code to build for inflate_table() */
alpar@9 54 typedef enum {
alpar@9 55 CODES,
alpar@9 56 LENS,
alpar@9 57 DISTS
alpar@9 58 } codetype;
alpar@9 59
alpar@9 60 int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
alpar@9 61 unsigned codes, code FAR * FAR *table,
alpar@9 62 unsigned FAR *bits, unsigned short FAR *work));