#include <immintrin.h>
#include "deflate.h"
+#include "deflate_p.h"
extern int read_buf(z_stream *strm, unsigned char *buf, unsigned size);
unsigned int str = s->strstart - s->insert;
s->ins_h = s->window[str];
if (str >= 1)
- UPDATE_HASH(s, s->ins_h, str + 1 - (MIN_MATCH-1));
+ insert_string(s, str + 2 - MIN_MATCH, 1);
#if MIN_MATCH != 3
- Call UPDATE_HASH() MIN_MATCH-3 more times
-#endif
+#error Call insert_string() MIN_MATCH-3 more times
while (s->insert) {
- UPDATE_HASH(s, s->ins_h, str);
- s->prev[str & s->w_mask] = s->head[s->ins_h];
- s->head[s->ins_h] = (Pos)str;
+ insert_string(s, str, 1);
str++;
s->insert--;
if (s->lookahead + s->insert < MIN_MATCH)
break;
}
+#else
+ unsigned int count;
+ if (unlikely(s->lookahead == 1)){
+ count = s->insert - 1;
+ }else{
+ count = s->insert;
+ }
+ insert_string(s,str,count);
+ s->insert -= count;
+#endif
}
/* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
* but this is not important since only literal bytes will be emitted.
if (str >= 1)
insert_string(s, str + 2 - MIN_MATCH, 1);
#if MIN_MATCH != 3
-#warning Call insert_string() MIN_MATCH-3 more times
-#endif
+#error Call insert_string() MIN_MATCH-3 more times
while (s->insert) {
insert_string(s, str, 1);
str++;
if (s->lookahead + s->insert < MIN_MATCH)
break;
}
+#else
+ unsigned int count;
+ if (unlikely(s->lookahead == 1)){
+ count = s->insert - 1;
+ }else{
+ count = s->insert;
+ }
+ insert_string(s,str,count);
+ s->insert -= count;
+#endif
}
/* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
* but this is not important since only literal bytes will be emitted.