]> wimlib.net Git - wimlib/blobdiff - src/xpress_compress.c
Update hyperlinks
[wimlib] / src / xpress_compress.c
index 99a4b46a3b3f37285644a0ebe9525579ccd68ee2..e192c870a0bdd3cb82d22d85db3f999d7b8824d6 100644 (file)
@@ -18,7 +18,7 @@
  * details.
  *
  * You should have received a copy of the GNU Lesser General Public License
- * along with this file; if not, see http://www.gnu.org/licenses/.
+ * along with this file; if not, see https://www.gnu.org/licenses/.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -279,7 +279,7 @@ xpress_init_output(struct xpress_output_bitstream *os, void *buffer, size_t size
  * If the output buffer space is exhausted, then the bits will be ignored, and
  * xpress_flush_output() will return 0 when it gets called.
  */
-static inline void
+static forceinline void
 xpress_write_bits(struct xpress_output_bitstream *os,
                  const u32 bits, const unsigned num_bits)
 {
@@ -303,7 +303,7 @@ xpress_write_bits(struct xpress_output_bitstream *os,
 /*
  * Interweave a literal byte into the output bitstream.
  */
-static inline void
+static forceinline void
 xpress_write_byte(struct xpress_output_bitstream *os, u8 byte)
 {
        if (os->next_byte < os->end)
@@ -313,7 +313,7 @@ xpress_write_byte(struct xpress_output_bitstream *os, u8 byte)
 /*
  * Interweave two literal bytes into the output bitstream.
  */
-static inline void
+static forceinline void
 xpress_write_u16(struct xpress_output_bitstream *os, u16 v)
 {
        if (os->end - os->next_byte >= 2) {
@@ -338,7 +338,7 @@ xpress_flush_output(struct xpress_output_bitstream *os)
        return os->next_byte - os->start;
 }
 
-static inline void
+static forceinline void
 xpress_write_extra_length_bytes(struct xpress_output_bitstream *os,
                                unsigned adjusted_len)
 {
@@ -353,7 +353,7 @@ xpress_write_extra_length_bytes(struct xpress_output_bitstream *os,
 }
 
 /* Output a match or literal.  */
-static inline void
+static forceinline void
 xpress_write_item(struct xpress_item item, struct xpress_output_bitstream *os,
                  const u32 codewords[], const u8 lens[])
 {
@@ -484,7 +484,7 @@ xpress_write(struct xpress_compressor *c, void *out, size_t out_nbytes_avail,
 
 /* Tally the Huffman symbol for a literal and return the intermediate
  * representation of that literal.  */
-static inline struct xpress_item
+static forceinline struct xpress_item
 xpress_record_literal(struct xpress_compressor *c, unsigned literal)
 {
        c->freqs[literal]++;
@@ -496,7 +496,7 @@ xpress_record_literal(struct xpress_compressor *c, unsigned literal)
 
 /* Tally the Huffman symbol for a match and return the intermediate
  * representation of that match.  */
-static inline struct xpress_item
+static forceinline struct xpress_item
 xpress_record_match(struct xpress_compressor *c, unsigned length, unsigned offset)
 {
        unsigned adjusted_len = length - XPRESS_MIN_MATCH_LEN;
@@ -544,7 +544,7 @@ xpress_compress_greedy(struct xpress_compressor * restrict c,
 
                length = hc_matchfinder_longest_match(&c->hc_mf,
                                                      in_begin,
-                                                     in_next - in_begin,
+                                                     in_next,
                                                      XPRESS_MIN_MATCH_LEN - 1,
                                                      in_end - in_next,
                                                      min(in_end - in_next, c->nice_match_length),
@@ -558,12 +558,12 @@ xpress_compress_greedy(struct xpress_compressor * restrict c,
                        *next_chosen_item++ =
                                xpress_record_match(c, length, offset);
                        in_next += 1;
-                       hc_matchfinder_skip_positions(&c->hc_mf,
-                                                     in_begin,
-                                                     in_next - in_begin,
-                                                     in_end - in_begin,
-                                                     length - 1,
-                                                     next_hashes);
+                       hc_matchfinder_skip_bytes(&c->hc_mf,
+                                                 in_begin,
+                                                 in_next,
+                                                 in_end,
+                                                 length - 1,
+                                                 next_hashes);
                        in_next += length - 1;
                } else {
                        /* No match found  */
@@ -610,7 +610,7 @@ xpress_compress_lazy(struct xpress_compressor * restrict c,
                /* Find the longest match at the current position.  */
                cur_len = hc_matchfinder_longest_match(&c->hc_mf,
                                                       in_begin,
-                                                      in_next - in_begin,
+                                                      in_next,
                                                       XPRESS_MIN_MATCH_LEN - 1,
                                                       in_end - in_next,
                                                       min(in_end - in_next, c->nice_match_length),
@@ -638,12 +638,12 @@ xpress_compress_lazy(struct xpress_compressor * restrict c,
                        *next_chosen_item++ =
                                xpress_record_match(c, cur_len, cur_offset);
 
-                       hc_matchfinder_skip_positions(&c->hc_mf,
-                                                     in_begin,
-                                                     in_next - in_begin,
-                                                     in_end - in_begin,
-                                                     cur_len - 1,
-                                                     next_hashes);
+                       hc_matchfinder_skip_bytes(&c->hc_mf,
+                                                 in_begin,
+                                                 in_next,
+                                                 in_end,
+                                                 cur_len - 1,
+                                                 next_hashes);
                        in_next += cur_len - 1;
                        continue;
                }
@@ -666,7 +666,7 @@ xpress_compress_lazy(struct xpress_compressor * restrict c,
                 */
                next_len = hc_matchfinder_longest_match(&c->hc_mf,
                                                        in_begin,
-                                                       in_next - in_begin,
+                                                       in_next,
                                                        cur_len,
                                                        in_end - in_next,
                                                        min(in_end - in_next, c->nice_match_length),
@@ -688,12 +688,12 @@ xpress_compress_lazy(struct xpress_compressor * restrict c,
                         * output the current match.  */
                        *next_chosen_item++ =
                                xpress_record_match(c, cur_len, cur_offset);
-                       hc_matchfinder_skip_positions(&c->hc_mf,
-                                                     in_begin,
-                                                     in_next - in_begin,
-                                                     in_end - in_begin,
-                                                     cur_len - 2,
-                                                     next_hashes);
+                       hc_matchfinder_skip_bytes(&c->hc_mf,
+                                                 in_begin,
+                                                 in_next,
+                                                 in_end,
+                                                 cur_len - 2,
+                                                 next_hashes);
                        in_next += cur_len - 2;
                        continue;
                }
@@ -961,12 +961,12 @@ xpress_find_matches(struct xpress_compressor * restrict c,
                                break;
                        --best_len;
                        do {
-                               bt_matchfinder_skip_position(&c->bt_mf,
-                                                            in_begin,
-                                                            in_next - in_begin,
-                                                            nice_len,
-                                                            c->max_search_depth,
-                                                            next_hashes);
+                               bt_matchfinder_skip_byte(&c->bt_mf,
+                                                        in_begin,
+                                                        in_next - in_begin,
+                                                        nice_len,
+                                                        c->max_search_depth,
+                                                        next_hashes);
                                cache_ptr->length = 0;
                                cache_ptr->offset = *in_next++;
                                cache_ptr++;