int lc; /* match length or unmatched char (if dist == 0) */
unsigned sx = 0; /* running index in symbol buffers */
- if (s->sym_next != 0) {
+ /* Local pointers to avoid indirection */
+ const unsigned int sym_next = s->sym_next;
+#ifdef LIT_MEM
+ uint16_t *d_buf = s->d_buf;
+ unsigned char *l_buf = s->l_buf;
+#else
+ unsigned char *sym_buf = s->sym_buf;
+#endif
+
+ if (sym_next != 0) {
do {
#ifdef LIT_MEM
- dist = s->d_buf[sx];
- lc = s->l_buf[sx++];
+ dist = d_buf[sx];
+ lc = l_buf[sx++];
#else
- dist = s->sym_buf[sx++] & 0xff;
- dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
- lc = s->sym_buf[sx++];
+ dist = sym_buf[sx++] & 0xff;
+ dist += (unsigned)(sym_buf[sx++] & 0xff) << 8;
+ lc = sym_buf[sx++];
#endif
if (dist == 0) {
zng_emit_lit(s, ltree, lc);
#else
Assert(s->pending < s->lit_bufsize + sx, "pending_buf overflow");
#endif
- } while (sx < s->sym_next);
+ } while (sx < sym_next);
}
zng_emit_end_block(s, ltree, 0);