summaryrefslogtreecommitdiff
path: root/deflate.h
diff options
context:
space:
mode:
authorNathan Moinvaziri <nathan@nathanm.com>2020-05-01 21:04:21 -0700
committerHans Kristian Rosbach <hk-github@circlestorm.org>2020-05-06 09:39:52 +0200
commite3c858c2c71b34bd5b76b57cbcfbf551fa52c464 (patch)
treed2e2888a3efff39f638f3bd34451fd868ddf3eef /deflate.h
parent951764a16807e67ea95720a5339853050693e9a6 (diff)
Split tree emitting code into its own source header to be included by both trees.c and deflate_quick.c so that their functions can be statically linked for performance reasons.
Diffstat (limited to 'deflate.h')
-rw-r--r--deflate.h51
1 files changed, 0 insertions, 51 deletions
diff --git a/deflate.h b/deflate.h
index 97adf17..97519e2 100644
--- a/deflate.h
+++ b/deflate.h
@@ -409,55 +409,4 @@ void ZLIB_INTERNAL flush_pending(PREFIX3(streamp) strm);
# define sent_bits_align(s)
#endif
-/* Bit buffer and deflate code stderr tracing */
-#ifdef ZLIB_DEBUG
-# define send_bits_trace(s, value, length) { \
- Tracevv((stderr, " l %2d v %4x ", length, value)); \
- Assert(length > 0 && length <= BIT_BUF_SIZE, "invalid length"); \
- }
-# define send_code_trace(s, c) \
- if (z_verbose > 2) { \
- fprintf(stderr, "\ncd %3d ", (c)); \
- }
-#else
-# define send_bits_trace(s, value, length)
-# define send_code_trace(s, c)
-#endif
-
-/* If not enough room in bit_buf, use (valid) bits from bit_buf and
- * (32 - bit_valid) bits from value, leaving (width - (32-bit_valid))
- * unused bits in value.
- */
-#define send_bits(s, t_val, t_len, bit_buf, bits_valid) {\
- uint32_t val = (uint32_t)t_val;\
- uint32_t len = (uint32_t)t_len;\
- uint32_t total_bits = bits_valid + len;\
- send_bits_trace(s, val, len);\
- sent_bits_add(s, len);\
- if (total_bits < BIT_BUF_SIZE) {\
- bit_buf |= val << bits_valid;\
- bits_valid = total_bits;\
- } else if (bits_valid == BIT_BUF_SIZE) {\
- put_uint32(s, bit_buf);\
- bit_buf = val;\
- bits_valid = len;\
- } else {\
- bit_buf |= val << bits_valid;\
- put_uint32(s, bit_buf);\
- bit_buf = val >> (BIT_BUF_SIZE - bits_valid);\
- bits_valid = total_bits - BIT_BUF_SIZE;\
- }\
-}
-
-/* Send a code of the given tree. c and tree must not have side effects */
-#ifdef ZLIB_DEBUG
-# define send_code(s, c, tree, bit_buf, bits_valid) { \
- send_code_trace(s, c); \
- send_bits(s, tree[c].Code, tree[c].Len, bit_buf, bits_valid); \
-}
-#else
-# define send_code(s, c, tree, bit_buf, bits_valid) \
- send_bits(s, tree[c].Code, tree[c].Len, bit_buf, bits_valid)
-#endif
-
#endif /* DEFLATE_H_ */