window is overwritten then future matches with far distances will fail to copy correctly. */
extra_safe = (wsize != 0 && out >= window && out + INFLATE_FAST_MIN_LEFT <= window + wsize);
- /* This is extremely latency sensitive, so empty inline assembly blocks are
- used to prevent the compiler from reassociating. */
#define REFILL() do { \
hold |= load_64_bits(in, bits); \
in += 7; \
- __asm__ volatile ("" : "+r"(in)); \
- uint64_t tmp = ((bits >> 3) & 7); \
- __asm__ volatile ("" : "+r"(tmp)); \
- in -= tmp; \
+ in -= ((bits >> 3) & 7); \
bits |= 56; \
} while (0)
do {
REFILL();
here = lcode + (hold & lmask);
+ if (here->op == 0) {
+ *out++ = (unsigned char)(here->val);
+ DROPBITS(here->bits);
+ here = lcode + (hold & lmask);
+ if (here->op == 0) {
+ *out++ = (unsigned char)(here->val);
+ DROPBITS(here->bits);
+ here = lcode + (hold & lmask);
+ }
+ }
dolen:
DROPBITS(here->bits);
op = here->op;
DROPBITS(op);
Tracevv((stderr, "inflate: length %u\n", len));
here = dcode + (hold & dmask);
+ if (bits < MAX_BITS + MAX_DIST_EXTRA_BITS) {
+ REFILL();
+ }
dodist:
DROPBITS(here->bits);
op = here->op;
strm->msg = (char *)errmsg; \
} while (0)
-#define INFLATE_FAST_MIN_HAVE 8
-#define INFLATE_FAST_MIN_LEFT 258
+#define INFLATE_FAST_MIN_HAVE 15
+#define INFLATE_FAST_MIN_LEFT 260
/* Load 64 bits from IN and place the bytes at offset BITS in the result. */
static inline uint64_t load_64_bits(const unsigned char *in, unsigned bits) {
#define MAX_BITS 15
/* all codes must not exceed MAX_BITS bits */
+#define MAX_DIST_EXTRA_BITS 13
+/* maximum number of extra distance bits */
#if MAX_MEM_LEVEL >= 8
# define DEF_MEM_LEVEL 8