#include "zbuild.h"
#include "deflate.h"
+#include "deflate_p.h"
#include "trees_emit.h"
#include "dfltcc_deflate.h"
#include "dfltcc_detail.h"
static inline void send_eobs(PREFIX3(streamp) strm, const struct dfltcc_param_v0 *param) {
deflate_state *state = (deflate_state *)strm->state;
- send_bits(state, PREFIX(bi_reverse)(param->eobs >> (15 - param->eobl), param->eobl), param->eobl, state->bi_buf, state->bi_valid);
+ send_bits(state, bi_reverse(param->eobs >> (15 - param->eobl), param->eobl), param->eobl, state->bi_buf, state->bi_valid);
PREFIX(flush_pending)(strm);
if (state->pending != 0) {
/* The remaining data is located in pending_out[0:pending]. If someone
void Z_INTERNAL zng_tr_flush_bits(deflate_state *s);
void Z_INTERNAL zng_tr_align(deflate_state *s);
void Z_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, uint32_t stored_len, int last);
-uint16_t Z_INTERNAL PREFIX(bi_reverse)(unsigned code, int len);
void Z_INTERNAL PREFIX(flush_pending)(PREFIX3(streamp) strm);
#define d_code(dist) ((dist) < 256 ? zng_dist_code[dist] : zng_dist_code[256+((dist)>>7)])
/* Mapping from a distance to a distance code. dist is the distance - 1 and
return (s->sym_next == s->sym_end);
}
+/* ===========================================================================
+ * Reverse the first len bits of a code using bit manipulation
+ */
+static inline uint16_t bi_reverse(unsigned code, int len) {
+ /* code: the value to invert */
+ /* len: its bit length */
+ Assert(len >= 1 && len <= 15, "code length must be 1-15");
+#define bitrev8(b) \
+ (uint8_t)((((uint8_t)(b) * 0x80200802ULL) & 0x0884422110ULL) * 0x0101010101ULL >> 32)
+ return (bitrev8(code >> 8) | (uint16_t)bitrev8(code) << 8) >> (16 - len);
+}
+
/* ===========================================================================
* Flush the current block, with given end-of-file flag.
* IN assertion: strstart is set to the end of the current match.
#include <stdio.h>
#include "zbuild.h"
#include "deflate.h"
+#include "deflate_p.h"
#include "trees.h"
static ct_data static_ltree[L_CODES+2];
/* The static distance tree is trivial: */
for (n = 0; n < D_CODES; n++) {
static_dtree[n].Len = 5;
- static_dtree[n].Code = PREFIX(bi_reverse)((unsigned)n, 5);
+ static_dtree[n].Code = bi_reverse((unsigned)n, 5);
}
}
#include "zbuild.h"
#include "deflate.h"
+#include "deflate_p.h"
#include "trees.h"
#include "trees_emit.h"
#include "trees_tbl.h"
if (len == 0)
continue;
/* Now reverse the bits */
- tree[n].Code = PREFIX(bi_reverse)(next_code[len]++, len);
+ tree[n].Code = bi_reverse(next_code[len]++, len);
Tracecv(tree != static_ltree, (stderr, "\nn %3d %c l %2d c %4x (%x) ",
n, (isgraph(n & 0xff) ? n : ' '), len, tree[n].Code, next_code[len]-1));
s->bi_valid -= 8;
}
}
-
-/* ===========================================================================
- * Reverse the first len bits of a code using bit manipulation
- */
-Z_INTERNAL uint16_t PREFIX(bi_reverse)(unsigned code, int len) {
- /* code: the value to invert */
- /* len: its bit length */
- Assert(len >= 1 && len <= 15, "code length must be 1-15");
-#define bitrev8(b) \
- (uint8_t)((((uint8_t)(b) * 0x80200802ULL) & 0x0884422110ULL) * 0x0101010101ULL >> 32)
- return (bitrev8(code >> 8) | (uint16_t)bitrev8(code) << 8) >> (16 - len);
-}