]> wimlib.net Git - wimlib/blobdiff - src/xpress_compress.c
Rename 'pos_t' to 'mf_pos_t'
[wimlib] / src / xpress_compress.c
index 5298af64ddb342e8598ee090cef50d48393738c8..b57d0ea62355157dbf72a16c2f8c75bd503e2ab4 100644 (file)
 #define MIN_LEVEL_FOR_NEAR_OPTIMAL     60
 
 /*
- * The maximum window order for the matchfinder.  This must be the base 2
- * logarithm of the maximum buffer size.
+ * Matchfinder definitions.  For XPRESS, only a 16-bit matchfinder is needed.
  */
-#define MATCHFINDER_MAX_WINDOW_ORDER   16
+#define mf_pos_t       u16
+#define MF_SUFFIX
 
 /*
  * Note: although XPRESS can potentially use a sliding window, it isn't well
@@ -59,8 +59,6 @@
  * optimizations.
  */
 
-#include <string.h>
-
 #include "wimlib/bitops.h"
 #include "wimlib/compress_common.h"
 #include "wimlib/compressor_ops.h"
@@ -910,10 +908,9 @@ xpress_find_matches(struct xpress_compressor * restrict c,
        const u8 *in_next = in_begin;
        const u8 * const in_end = in_begin + in_nbytes;
        struct lz_match *cache_ptr = c->match_cache;
-       u32 next_hash;
+       u32 next_hash = 0;
 
        bt_matchfinder_init(&c->bt_mf);
-       next_hash = bt_matchfinder_hash_3_bytes(in_next);
 
        do {
                struct lz_match *matches;
@@ -939,8 +936,7 @@ xpress_find_matches(struct xpress_compressor * restrict c,
                cache_ptr =
                        bt_matchfinder_get_matches(&c->bt_mf,
                                                   in_begin,
-                                                  in_next,
-                                                  XPRESS_MIN_MATCH_LEN,
+                                                  in_next - in_begin,
                                                   in_end - in_next,
                                                   min(in_end - in_next, c->nice_match_length),
                                                   c->max_search_depth,
@@ -967,8 +963,8 @@ xpress_find_matches(struct xpress_compressor * restrict c,
                        do {
                                bt_matchfinder_skip_position(&c->bt_mf,
                                                             in_begin,
-                                                            in_next,
-                                                            in_end,
+                                                            in_next - in_begin,
+                                                            in_end - in_next,
                                                             min(in_end - in_next,
                                                                 c->nice_match_length),
                                                             c->max_search_depth,