xref: /titanic_44/usr/src/uts/common/zmod/inftrees.h (revision e1c679fa4b0ab8c4bcaa6263974ca0c46e5b027f)
1 /*
2  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * inftrees.h -- header to use inftrees.c
8  * Copyright (C) 1995-1998 Mark Adler
9  * For conditions of distribution and use, see copyright notice in zlib.h
10  */
11 
12 #ifndef	_INFTREES_H
13 #define	_INFTREES_H
14 
15 #pragma ident	"%Z%%M%	%I%	%E% SMI"
16 
17 #ifdef	__cplusplus
18 extern "C" {
19 #endif
20 
21 /* Huffman code lookup table entry--this entry is four bytes for machines
22    that have 16-bit pointers (e.g. PC's in the small or medium model). */
23 
24 typedef struct inflate_huft_s inflate_huft;
25 
26 struct inflate_huft_s {
27   union {
28     struct {
29       Byte Exop;        /* number of extra bits or operation */
30       Byte Bits;        /* number of bits in this code or subcode */
31     } what;
32     uInt pad;           /* pad structure to a power of 2 (4 bytes for */
33   } word;               /*  16-bit, 8 bytes for 32-bit int's) */
34   uInt base;            /* literal, length base, distance base,
35                            or table offset */
36 };
37 
38 /* Maximum size of dynamic tree.  The maximum found in a long but non-
39    exhaustive search was 1004 huft structures (850 for length/literals
40    and 154 for distances, the latter actually the result of an
41    exhaustive search).  The actual maximum is not known, but the
42    value below is more than safe. */
43 #define MANY 1440
44 
45 extern int inflate_trees_bits(
46     uIntf *,                    /* 19 code lengths */
47     uIntf *,                    /* bits tree desired/actual depth */
48     inflate_huft * FAR *,       /* bits tree result */
49     inflate_huft *,             /* space for trees */
50     z_streamp);                 /* for messages */
51 
52 extern int inflate_trees_dynamic(
53     uInt,                       /* number of literal/length codes */
54     uInt,                       /* number of distance codes */
55     uIntf *,                    /* that many (total) code lengths */
56     uIntf *,                    /* literal desired/actual bit depth */
57     uIntf *,                    /* distance desired/actual bit depth */
58     inflate_huft * FAR *,       /* literal/length tree result */
59     inflate_huft * FAR *,       /* distance tree result */
60     inflate_huft *,             /* space for trees */
61     z_streamp);                 /* for messages */
62 
63 extern int inflate_trees_fixed(
64     uIntf *,                    /* literal desired/actual bit depth */
65     uIntf *,                    /* distance desired/actual bit depth */
66     inflate_huft * FAR *,       /* literal/length tree result */
67     inflate_huft * FAR *,       /* distance tree result */
68     z_streamp);                 /* for memory allocation */
69 
70 #ifdef	__cplusplus
71 }
72 #endif
73 
74 #endif	/* _INFTREES_H */
75