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