MCPcopy Create free account
hub / github.com/Squirrel/Squirrel.Windows / inflate_fast

Function inflate_fast

src/Setup/unzip.cpp:1956–2111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1954// distance pair plus four bytes for overloading the bit buffer.
1955
1956int inflate_fast(
1957uInt bl, uInt bd,
1958const inflate_huft *tl,
1959const inflate_huft *td, // need separate declaration for Borland C++
1960inflate_blocks_statef *s,
1961z_streamp z)
1962{
1963 const inflate_huft *t; // temporary pointer
1964 uInt e; // extra bits or operation
1965 uLong b; // bit buffer
1966 uInt k; // bits in bit buffer
1967 Byte *p; // input data pointer
1968 uInt n; // bytes available there
1969 Byte *q; // output window write pointer
1970 uInt m; // bytes to end of window or read pointer
1971 uInt ml; // mask for literal/length tree
1972 uInt md; // mask for distance tree
1973 uInt c; // bytes to copy
1974 uInt d; // distance back to copy from
1975 Byte *r; // copy source pointer
1976
1977 // load input, output, bit values
1978 LOAD
1979
1980 // initialize masks
1981 ml = inflate_mask[bl];
1982 md = inflate_mask[bd];
1983
1984 // do until not enough input or output space for fast loop
1985 do { // assume called with m >= 258 && n >= 10
1986 // get literal/length code
1987 GRABBITS(20) // max bits for literal/length code
1988 if ((e = (t = tl + ((uInt)b & ml))->exop) == 0)
1989 {
1990 DUMPBITS(t->bits)
1991 LuTracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
1992 "inflate: * literal '%c'\n" :
1993 "inflate: * literal 0x%02x\n", t->base));
1994 *q++ = (Byte)t->base;
1995 m--;
1996 continue;
1997 }
1998 for (;;) {
1999 DUMPBITS(t->bits)
2000 if (e & 16)
2001 {
2002 // get extra bits for length
2003 e &= 15;
2004 c = t->base + ((uInt)b & inflate_mask[e]);
2005 DUMPBITS(e)
2006 LuTracevv((stderr, "inflate: * length %u\n", c));
2007
2008 // decode distance base of block to copy
2009 GRABBITS(15); // max bits for distance code
2010 e = (t = td + ((uInt)b & md))->exop;
2011 for (;;) {
2012 DUMPBITS(t->bits)
2013 if (e & 16)

Callers 1

inflate_codesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected