summaryrefslogtreecommitdiffstats
path: root/lib/libz/deflate.h
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1998-02-28 06:04:26 +0000
committersteve <steve@FreeBSD.org>1998-02-28 06:04:26 +0000
commit9f86c0bf8cf1224d46bbefe1d308f2cc8186a79b (patch)
treef03de58d136ec48f008735e374079754bdfee40f /lib/libz/deflate.h
parent5372e3085661ee9071da924c16a5cfdc12f7590d (diff)
downloadFreeBSD-src-9f86c0bf8cf1224d46bbefe1d308f2cc8186a79b.zip
FreeBSD-src-9f86c0bf8cf1224d46bbefe1d308f2cc8186a79b.tar.gz
Initial import of zlib-1.1.1
PR: 5869 Reviewed by: jdp
Diffstat (limited to 'lib/libz/deflate.h')
-rw-r--r--lib/libz/deflate.h47
1 files changed, 45 insertions, 2 deletions
diff --git a/lib/libz/deflate.h b/lib/libz/deflate.h
index a7daf7f..0483016 100644
--- a/lib/libz/deflate.h
+++ b/lib/libz/deflate.h
@@ -1,5 +1,5 @@
/* deflate.h -- internal compression state
- * Copyright (C) 1995-1996 Jean-loup Gailly
+ * Copyright (C) 1995-1998 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -8,7 +8,7 @@
subject to change. Applications should only use zlib.h.
*/
-/* $Id: deflate.h,v 1.10 1996/07/02 12:41:00 me Exp $ */
+/* @(#) $Id$ */
#ifndef _DEFLATE_H
#define _DEFLATE_H
@@ -83,6 +83,7 @@ typedef struct internal_state {
z_streamp strm; /* pointer back to this zlib stream */
int status; /* as the name implies */
Bytef *pending_buf; /* output still pending */
+ ulg pending_buf_size; /* size of pending_buf */
Bytef *pending_out; /* next pending byte to output to the stream */
int pending; /* nb of bytes in the pending buffer */
int noheader; /* suppress zlib header and adler32 */
@@ -272,4 +273,46 @@ ulg _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
void _tr_align OF((deflate_state *s));
void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
int eof));
+
+#define d_code(dist) \
+ ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
+/* Mapping from a distance to a distance code. dist is the distance - 1 and
+ * must not have side effects. _dist_code[256] and _dist_code[257] are never
+ * used.
+ */
+
+#ifndef DEBUG
+/* Inline versions of _tr_tally for speed: */
+
+#if defined(GEN_TREES_H) || !defined(STDC)
+ extern uch _length_code[];
+ extern uch _dist_code[];
+#else
+ extern const uch _length_code[];
+ extern const uch _dist_code[];
+#endif
+
+# define _tr_tally_lit(s, c, flush) \
+ { uch cc = (c); \
+ s->d_buf[s->last_lit] = 0; \
+ s->l_buf[s->last_lit++] = cc; \
+ s->dyn_ltree[cc].Freq++; \
+ flush = (s->last_lit == s->lit_bufsize-1); \
+ }
+# define _tr_tally_dist(s, distance, length, flush) \
+ { uch len = (length); \
+ ush dist = (distance); \
+ s->d_buf[s->last_lit] = dist; \
+ s->l_buf[s->last_lit++] = len; \
+ dist--; \
+ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
+ s->dyn_dtree[d_code(dist)].Freq++; \
+ flush = (s->last_lit == s->lit_bufsize-1); \
+ }
+#else
+# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
+# define _tr_tally_dist(s, distance, length, flush) \
+ flush = _tr_tally(s, distance, length)
+#endif
+
#endif
OpenPOWER on IntegriCloud