]> wimlib.net Git - wimlib/blobdiff - include/wimlib/bt_matchfinder.h
Split prefetch() into prefetchr() and prefetchw()
[wimlib] / include / wimlib / bt_matchfinder.h
index 1d30e36216a05876e8074956b3b7dfe4de2e012c..4fe754c95c3e7f181460ad01bd3b41646bd7a384 100644 (file)
@@ -127,8 +127,9 @@ bt_right_child(struct bt_matchfinder *mf, pos_t node)
  *     The maximum permissible match length at this position.
  * @nice_len
  *     Stop searching if a match of at least this length is found.
  *     The maximum permissible match length at this position.
  * @nice_len
  *     Stop searching if a match of at least this length is found.
+ *     Must be <= @max_len.
  * @max_search_depth
  * @max_search_depth
- *     Limit on the number of potential matches to consider.
+ *     Limit on the number of potential matches to consider.  Must be >= 1.
  * @next_hash
  *     Pointer to the hash code for the current sequence, which was computed
  *     one position in advance so that the binary tree root could be
  * @next_hash
  *     Pointer to the hash code for the current sequence, which was computed
  *     one position in advance so that the binary tree root could be
@@ -168,7 +169,7 @@ bt_matchfinder_get_matches(struct bt_matchfinder * const restrict mf,
        unsigned len;
        unsigned best_len = min_len - 1;
 
        unsigned len;
        unsigned best_len = min_len - 1;
 
-       if (unlikely(max_len < LZ_HASH_REQUIRED_NBYTES + 1)) {
+       if (unlikely(max_len < LZ_HASH3_REQUIRED_NBYTES + 1)) {
                *best_len_ret = best_len;
                return lz_matchptr;
        }
                *best_len_ret = best_len;
                return lz_matchptr;
        }
@@ -177,7 +178,7 @@ bt_matchfinder_get_matches(struct bt_matchfinder * const restrict mf,
        *next_hash = bt_matchfinder_hash_3_bytes(in_next + 1);
        cur_node = mf->hash_tab[hash];
        mf->hash_tab[hash] = in_next - in_begin;
        *next_hash = bt_matchfinder_hash_3_bytes(in_next + 1);
        cur_node = mf->hash_tab[hash];
        mf->hash_tab[hash] = in_next - in_begin;
-       prefetch(&mf->hash_tab[*next_hash]);
+       prefetchw(&mf->hash_tab[*next_hash]);
 
        pending_lt_ptr = bt_left_child(mf, in_next - in_begin);
        pending_gt_ptr = bt_right_child(mf, in_next - in_begin);
 
        pending_lt_ptr = bt_left_child(mf, in_next - in_begin);
        pending_gt_ptr = bt_right_child(mf, in_next - in_begin);
@@ -277,14 +278,14 @@ bt_matchfinder_skip_position(struct bt_matchfinder * const restrict mf,
        unsigned best_lt_len, best_gt_len;
        unsigned len;
 
        unsigned best_lt_len, best_gt_len;
        unsigned len;
 
-       if (unlikely(in_end - in_next < LZ_HASH_REQUIRED_NBYTES + 1))
+       if (unlikely(in_end - in_next < LZ_HASH3_REQUIRED_NBYTES + 1))
                return;
 
        hash = *next_hash;
        *next_hash = bt_matchfinder_hash_3_bytes(in_next + 1);
        cur_node = mf->hash_tab[hash];
        mf->hash_tab[hash] = in_next - in_begin;
                return;
 
        hash = *next_hash;
        *next_hash = bt_matchfinder_hash_3_bytes(in_next + 1);
        cur_node = mf->hash_tab[hash];
        mf->hash_tab[hash] = in_next - in_begin;
-       prefetch(&mf->hash_tab[*next_hash]);
+       prefetchw(&mf->hash_tab[*next_hash]);
 
        depth_remaining = max_search_depth;
        pending_lt_ptr = bt_left_child(mf, in_next - in_begin);
 
        depth_remaining = max_search_depth;
        pending_lt_ptr = bt_left_child(mf, in_next - in_begin);