- pos_t *pending_lt_ptr, *pending_gt_ptr;
- unsigned best_lt_len, best_gt_len;
- unsigned len;
- unsigned best_len = min_len - 1;
-
- if (unlikely(max_len < LZ_HASH3_REQUIRED_NBYTES + 1)) {
- *best_len_ret = best_len;
- return lz_matchptr;
+ mf_pos_t *pending_lt_ptr, *pending_gt_ptr;
+ u32 best_lt_len, best_gt_len;
+ u32 len;
+ u32 best_len = 3;
+
+ next_seq4 = load_u32_unaligned(in_next + 1);
+ next_seq3 = loaded_u32_to_u24(next_seq4);
+
+ hash3 = next_hashes[0];
+ hash4 = next_hashes[1];
+
+ next_hashes[0] = lz_hash(next_seq3, BT_MATCHFINDER_HASH3_ORDER);
+ next_hashes[1] = lz_hash(next_seq4, BT_MATCHFINDER_HASH4_ORDER);
+ prefetchw(&mf->hash3_tab[next_hashes[0]]);
+ prefetchw(&mf->hash4_tab[next_hashes[1]]);
+
+#ifdef BT_MATCHFINDER_HASH2_ORDER
+ seq2 = load_u16_unaligned(in_next);
+ hash2 = lz_hash(seq2, BT_MATCHFINDER_HASH2_ORDER);
+ cur_node = mf->hash2_tab[hash2];
+ mf->hash2_tab[hash2] = cur_pos;
+ if (record_matches &&
+ seq2 == load_u16_unaligned(&in_begin[cur_node]) &&
+ likely(in_next != in_begin))
+ {
+ lz_matchptr->length = 2;
+ lz_matchptr->offset = in_next - &in_begin[cur_node];
+ lz_matchptr++;
+ }
+#endif
+
+ cur_node = mf->hash3_tab[hash3][0];
+ mf->hash3_tab[hash3][0] = cur_pos;
+#if BT_MATCHFINDER_HASH3_WAYS >= 2
+ cur_node_2 = mf->hash3_tab[hash3][1];
+ mf->hash3_tab[hash3][1] = cur_node;
+#endif
+ if (record_matches && likely(in_next != in_begin)) {
+ u32 seq3 = load_u24_unaligned(in_next);
+ if (seq3 == load_u24_unaligned(&in_begin[cur_node])) {
+ lz_matchptr->length = 3;
+ lz_matchptr->offset = in_next - &in_begin[cur_node];
+ lz_matchptr++;
+ }
+ #if BT_MATCHFINDER_HASH3_WAYS >= 2
+ else if (seq3 == load_u24_unaligned(&in_begin[cur_node_2])) {
+ lz_matchptr->length = 3;
+ lz_matchptr->offset = in_next - &in_begin[cur_node_2];
+ lz_matchptr++;
+ }
+ #endif