# ifdef HAVE_BUILTIN_CTZLL
uint32_t compare256_neon(const uint8_t *src0, const uint8_t *src1);
-uint32_t longest_match_neon(deflate_state *const s, Pos cur_match);
-uint32_t longest_match_slow_neon(deflate_state *const s, Pos cur_match);
+uint32_t longest_match_neon(deflate_state *const s, uint32_t cur_match);
+uint32_t longest_match_slow_neon(deflate_state *const s, uint32_t cur_match);
# endif
void slide_hash_neon(deflate_state *s);
void inflate_fast_neon(PREFIX3(stream) *strm, uint32_t start);
void inflate_fast_c(PREFIX3(stream) *strm, uint32_t start);
-uint32_t longest_match_c(deflate_state *const s, Pos cur_match);
-uint32_t longest_match_slow_c(deflate_state *const s, Pos cur_match);
+uint32_t longest_match_c(deflate_state *const s, uint32_t cur_match);
+uint32_t longest_match_slow_c(deflate_state *const s, uint32_t cur_match);
void slide_hash_c(deflate_state *s);
void slide_hash_lsx(deflate_state *s);
# ifdef HAVE_BUILTIN_CTZ
uint32_t compare256_lsx(const uint8_t *src0, const uint8_t *src1);
- uint32_t longest_match_lsx(deflate_state *const s, Pos cur_match);
- uint32_t longest_match_slow_lsx(deflate_state *const s, Pos cur_match);
+ uint32_t longest_match_lsx(deflate_state *const s, uint32_t cur_match);
+ uint32_t longest_match_slow_lsx(deflate_state *const s, uint32_t cur_match);
# endif
uint8_t* chunkmemset_safe_lsx(uint8_t *out, uint8_t *from, unsigned len, unsigned left);
void inflate_fast_lsx(PREFIX3(stream) *strm, uint32_t start);
void slide_hash_lasx(deflate_state *s);
# ifdef HAVE_BUILTIN_CTZ
uint32_t compare256_lasx(const uint8_t *src0, const uint8_t *src1);
- uint32_t longest_match_lasx(deflate_state *const s, Pos cur_match);
- uint32_t longest_match_slow_lasx(deflate_state *const s, Pos cur_match);
+ uint32_t longest_match_lasx(deflate_state *const s, uint32_t cur_match);
+ uint32_t longest_match_slow_lasx(deflate_state *const s, uint32_t cur_match);
# endif
uint8_t* chunkmemset_safe_lasx(uint8_t *out, uint8_t *from, unsigned len, unsigned left);
void inflate_fast_lasx(PREFIX3(stream) *strm, uint32_t start);
#ifdef POWER9
uint32_t compare256_power9(const uint8_t *src0, const uint8_t *src1);
-uint32_t longest_match_power9(deflate_state *const s, Pos cur_match);
-uint32_t longest_match_slow_power9(deflate_state *const s, Pos cur_match);
+uint32_t longest_match_power9(deflate_state *const s, uint32_t cur_match);
+uint32_t longest_match_slow_power9(deflate_state *const s, uint32_t cur_match);
#endif
uint8_t* chunkmemset_safe_rvv(uint8_t *out, uint8_t *from, unsigned len, unsigned left);
uint32_t compare256_rvv(const uint8_t *src0, const uint8_t *src1);
-uint32_t longest_match_rvv(deflate_state *const s, Pos cur_match);
-uint32_t longest_match_slow_rvv(deflate_state *const s, Pos cur_match);
+uint32_t longest_match_rvv(deflate_state *const s, uint32_t cur_match);
+uint32_t longest_match_slow_rvv(deflate_state *const s, uint32_t cur_match);
void slide_hash_rvv(deflate_state *s);
void inflate_fast_rvv(PREFIX3(stream) *strm, uint32_t start);
#endif
# ifdef HAVE_BUILTIN_CTZ
uint32_t compare256_sse2(const uint8_t *src0, const uint8_t *src1);
- uint32_t longest_match_sse2(deflate_state *const s, Pos cur_match);
- uint32_t longest_match_slow_sse2(deflate_state *const s, Pos cur_match);
+ uint32_t longest_match_sse2(deflate_state *const s, uint32_t cur_match);
+ uint32_t longest_match_slow_sse2(deflate_state *const s, uint32_t cur_match);
# endif
void slide_hash_sse2(deflate_state *s);
void inflate_fast_sse2(PREFIX3(stream)* strm, uint32_t start);
# ifdef HAVE_BUILTIN_CTZ
uint32_t compare256_avx2(const uint8_t *src0, const uint8_t *src1);
- uint32_t longest_match_avx2(deflate_state *const s, Pos cur_match);
- uint32_t longest_match_slow_avx2(deflate_state *const s, Pos cur_match);
+ uint32_t longest_match_avx2(deflate_state *const s, uint32_t cur_match);
+ uint32_t longest_match_slow_avx2(deflate_state *const s, uint32_t cur_match);
# endif
void slide_hash_avx2(deflate_state *s);
void inflate_fast_avx2(PREFIX3(stream)* strm, uint32_t start);
void inflate_fast_avx512(PREFIX3(stream)* strm, uint32_t start);
# ifdef HAVE_BUILTIN_CTZLL
uint32_t compare256_avx512(const uint8_t *src0, const uint8_t *src1);
- uint32_t longest_match_avx512(deflate_state *const s, Pos cur_match);
- uint32_t longest_match_slow_avx512(deflate_state *const s, Pos cur_match);
+ uint32_t longest_match_avx512(deflate_state *const s, uint32_t cur_match);
+ uint32_t longest_match_slow_avx512(deflate_state *const s, uint32_t cur_match);
# endif
#endif
#ifdef X86_AVX512VNNI
* of window index 0 (in particular we have to avoid a match
* of the string with itself at the start of the input file).
*/
- match_len = FUNCTABLE_CALL(longest_match)(s, hash_head);
+ match_len = FUNCTABLE_CALL(longest_match)(s, (uint32_t)hash_head);
/* longest_match() sets match_start */
}
} else {
* of window index 0 (in particular we have to avoid a match
* of the string with itself at the start of the input file).
*/
- current_match.match_length = (uint16_t)FUNCTABLE_CALL(longest_match)(s, hash_head);
+ current_match.match_length = (uint16_t)FUNCTABLE_CALL(longest_match)(s, (uint32_t)hash_head);
current_match.match_start = (uint16_t)s->match_start;
if (UNLIKELY(current_match.match_length < WANT_MIN_MATCH))
current_match.match_length = 1;
/* Compression function. Returns the block state after the call. */
typedef block_state (*compress_func) (deflate_state *s, int flush);
/* Match function. Returns the longest match. */
-typedef uint32_t (*match_func) (deflate_state *const s, Pos cur_match);
+typedef uint32_t (*match_func) (deflate_state *const s, uint32_t cur_match);
#endif
* of window index 0 (in particular we have to avoid a match
* of the string with itself at the start of the input file).
*/
- match_len = longest_match(s, hash_head);
+ match_len = longest_match(s, (uint32_t)hash_head);
/* longest_match() sets match_start */
if (match_len <= 5 && (s->strategy == Z_FILTERED)) {
functable.inflate_fast(strm, start);
}
-static uint32_t longest_match_stub(deflate_state* const s, Pos cur_match) {
+static uint32_t longest_match_stub(deflate_state* const s, uint32_t cur_match) {
FUNCTABLE_INIT_ABORT;
return functable.longest_match(s, cur_match);
}
-static uint32_t longest_match_slow_stub(deflate_state* const s, Pos cur_match) {
+static uint32_t longest_match_slow_stub(deflate_state* const s, uint32_t cur_match) {
FUNCTABLE_INIT_ABORT;
return functable.longest_match_slow(s, cur_match);
}
uint32_t (* crc32_fold_final) (struct crc32_fold_s *crc);
uint32_t (* crc32_fold_reset) (struct crc32_fold_s *crc);
void (* inflate_fast) (PREFIX3(stream) *strm, uint32_t start);
- uint32_t (* longest_match) (deflate_state *const s, Pos cur_match);
- uint32_t (* longest_match_slow) (deflate_state *const s, Pos cur_match);
+ uint32_t (* longest_match) (deflate_state *const s, uint32_t cur_match);
+ uint32_t (* longest_match_slow) (deflate_state *const s, uint32_t cur_match);
void (* slide_hash) (deflate_state *s);
};
* The LONGEST_MATCH_SLOW variant spends more time to attempt to find longer
* matches once a match has already been found.
*/
-Z_INTERNAL uint32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) {
+Z_INTERNAL uint32_t LONGEST_MATCH(deflate_state *const s, uint32_t cur_match) {
const unsigned wmask = W_MASK(s);
unsigned int strstart = s->strstart;
const unsigned char *window = s->window;
const unsigned char *scan;
const unsigned char *mbase_start = window;
const unsigned char *mbase_end;
- Pos limit;
+ uint32_t limit;
#ifdef LONGEST_MATCH_SLOW
- Pos limit_base;
+ uint32_t limit_base;
#else
int32_t early_exit;
#endif
uint32_t nice_match = (uint32_t)s->nice_match;
uint32_t best_len, offset;
uint32_t lookahead = s->lookahead;
- Pos match_offset = 0;
+ uint32_t match_offset = 0;
uint64_t scan_start;
uint64_t scan_end;
/* Stop when cur_match becomes <= limit. To simplify the code,
* we prevent matches with the string of window index 0
*/
- limit = strstart > MAX_DIST(s) ? (Pos)(strstart - MAX_DIST(s)) : 0;
+ limit = strstart > MAX_DIST(s) ? (strstart - MAX_DIST(s)) : 0;
#ifdef LONGEST_MATCH_SLOW
limit_base = limit;
if (best_len >= STD_MIN_MATCH) {
/* We're continuing search (lazy evaluation). */
uint32_t hash;
- Pos pos;
+ uint32_t pos;
/* Find a most distant chain starting from scan with index=1 (index=0 corresponds
* to cur_match). We cannot use s->prev[strstart+1,...] immediately, because
/* If we're starting with best_len >= 3, we can use offset search. */
pos = head[hash];
if (pos < cur_match) {
- match_offset = (Pos)(i - 2);
+ match_offset = i - 2;
cur_match = pos;
}
}
if (UNLIKELY(len > STD_MIN_MATCH && match_start + len < strstart)) {
const unsigned char *scan_endstr;
uint32_t hash;
- Pos pos, next_pos;
+ uint32_t pos, next_pos;
/* Go back to offset 0 */
cur_match -= match_offset;
if (pos <= limit_base + i)
goto break_matching;
next_pos = pos;
- match_offset = (Pos)i;
+ match_offset = i;
}
}
/* Switch cur_match to next_pos chain */
pos = head[hash];
if (pos < cur_match) {
- match_offset = (Pos)(len - (STD_MIN_MATCH+1));
+ match_offset = len - (STD_MIN_MATCH+1);
if (pos <= limit_base + match_offset)
goto break_matching;
cur_match = pos;