+ struct lz_hc *mf = (struct lz_hc *)_mf;
+ const u8 * const window = mf->base.cur_window;
+ const u32 cur_pos = mf->base.cur_window_pos++;
+ const u8 * const strptr = &window[cur_pos];
+ const u32 bytes_remaining = mf->base.cur_window_size - cur_pos;
+ u32 * const prev_tab = mf->hash_tab + LZ_HC_HASH_LEN;
+ const u32 max_len = min(bytes_remaining, mf->base.params.max_match_len);
+ const u32 nice_len = min(max_len, mf->base.params.nice_match_len);
+ u32 best_len = mf->base.params.min_match_len - 1;
+ u32 depth_remaining = mf->base.params.max_search_depth;
+ struct lz_match *lz_matchptr = matches;
+ u32 hash;
+ u32 cur_match;
+ u32 sequence;
+
+ if (unlikely(bytes_remaining < LZ_HASH_REQUIRED_NBYTES + 1))
+ return 0;
+
+ /* Insert the current position into the appropriate hash chain and set
+ * 'cur_match' to the previous head.
+ *
+ * For a slight performance improvement, we do each hash calculation one
+ * position in advance and prefetch the necessary hash table entry. */
+
+ hash = mf->next_hash;
+ mf->next_hash = lz_hc_hash(strptr + 1);
+ prefetch(&mf->hash_tab[mf->next_hash]);
+ cur_match = mf->hash_tab[hash];
+ mf->hash_tab[hash] = cur_pos;
+ prev_tab[cur_pos] = cur_match;
+
+ /* Ensure we can find a match of at least the requested length. */
+ if (unlikely(best_len >= max_len))
+ return 0;