summaryrefslogtreecommitdiffstats
path: root/lib/libz/deflate.h
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1998-02-28 06:08:17 +0000
committersteve <steve@FreeBSD.org>1998-02-28 06:08:17 +0000
commit237ff31c6d598cfde1da4334ec1a86b35f19571c (patch)
tree6427e9261e25aa42e2def462b2cc2b1a1b674e9a /lib/libz/deflate.h
parent8514318799bade2eb145aee36f8731edc4053a78 (diff)
downloadFreeBSD-src-237ff31c6d598cfde1da4334ec1a86b35f19571c.zip
FreeBSD-src-237ff31c6d598cfde1da4334ec1a86b35f19571c.tar.gz
Merge conflicts.
Diffstat (limited to 'lib/libz/deflate.h')
-rw-r--r--lib/libz/deflate.h45
1 files changed, 44 insertions, 1 deletions
diff --git a/lib/libz/deflate.h b/lib/libz/deflate.h
index 689adea..5cf65ec 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
*/
@@ -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