]> wimlib.net Git - wimlib/blobdiff - include/wimlib/bt_matchfinder.h
Stop force-inlining everything marked 'inline'
[wimlib] / include / wimlib / bt_matchfinder.h
index e1a8295c40473ab7c8e73015dc0f0cd4670956a4..05bd07d9daf540acfd2ad8abdcbe17a8aa8000d8 100644 (file)
@@ -1,11 +1,21 @@
 /*
- * bt_matchfinder.h
+ * bt_matchfinder.h - Lempel-Ziv matchfinding with a hash table of binary trees
  *
- * Author:     Eric Biggers
- * Year:       2014, 2015
+ * The following copying information applies to this specific source code file:
  *
- * The author dedicates this file to the public domain.
- * You can do whatever you want with this file.
+ * Written in 2014-2016 by Eric Biggers <ebiggers3@gmail.com>
+ *
+ * To the extent possible under law, the author(s) have dedicated all copyright
+ * and related and neighboring rights to this software to the public domain
+ * worldwide via the Creative Commons Zero 1.0 Universal Public Domain
+ * Dedication (the "CC0").
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the CC0 for more details.
+ *
+ * You should have received a copy of the CC0 along with this software; if not
+ * see <http://creativecommons.org/publicdomain/zero/1.0/>.
  *
  * ----------------------------------------------------------------------------
  *
@@ -98,7 +108,7 @@ struct TEMPLATED(bt_matchfinder) {
 
 /* Return the number of bytes that must be allocated for a 'bt_matchfinder' that
  * can work with buffers up to the specified size.  */
-static inline size_t
+static forceinline size_t
 TEMPLATED(bt_matchfinder_size)(size_t max_bufsize)
 {
        return sizeof(struct TEMPLATED(bt_matchfinder)) +
@@ -106,19 +116,19 @@ TEMPLATED(bt_matchfinder_size)(size_t max_bufsize)
 }
 
 /* Prepare the matchfinder for a new input buffer.  */
-static inline void
+static forceinline void
 TEMPLATED(bt_matchfinder_init)(struct TEMPLATED(bt_matchfinder) *mf)
 {
        memset(mf, 0, sizeof(*mf));
 }
 
-static inline mf_pos_t *
+static forceinline mf_pos_t *
 TEMPLATED(bt_left_child)(struct TEMPLATED(bt_matchfinder) *mf, u32 node)
 {
        return &mf->child_tab[(node << 1) + 0];
 }
 
-static inline mf_pos_t *
+static forceinline mf_pos_t *
 TEMPLATED(bt_right_child)(struct TEMPLATED(bt_matchfinder) *mf, u32 node)
 {
        return &mf->child_tab[(node << 1) + 1];
@@ -131,7 +141,7 @@ TEMPLATED(bt_right_child)(struct TEMPLATED(bt_matchfinder) *mf, u32 node)
 
 /* Advance the binary tree matchfinder by one byte, optionally recording
  * matches.  @record_matches should be a compile-time constant.  */
-static inline struct lz_match *
+static forceinline struct lz_match *
 TEMPLATED(bt_matchfinder_advance_one_byte)(struct TEMPLATED(bt_matchfinder) * const restrict mf,
                                           const u8 * const restrict in_begin,
                                           const ptrdiff_t cur_pos,
@@ -234,8 +244,7 @@ TEMPLATED(bt_matchfinder_advance_one_byte)(struct TEMPLATED(bt_matchfinder) * co
                matchptr = &in_begin[cur_node];
 
                if (matchptr[len] == in_next[len]) {
-                       len = lz_extend(in_next, matchptr, len + 1,
-                                       (record_matches ? max_len : nice_len));
+                       len = lz_extend(in_next, matchptr, len + 1, max_len);
                        if (!record_matches || len > best_len) {
                                if (record_matches) {
                                        best_len = len;
@@ -314,7 +323,7 @@ TEMPLATED(bt_matchfinder_advance_one_byte)(struct TEMPLATED(bt_matchfinder) * co
  * The return value is a pointer to the next available slot in the @lz_matchptr
  * array.  (If no matches were found, this will be the same as @lz_matchptr.)
  */
-static inline struct lz_match *
+static forceinline struct lz_match *
 TEMPLATED(bt_matchfinder_get_matches)(struct TEMPLATED(bt_matchfinder) *mf,
                                      const u8 *in_begin,
                                      ptrdiff_t cur_pos,
@@ -343,11 +352,10 @@ TEMPLATED(bt_matchfinder_get_matches)(struct TEMPLATED(bt_matchfinder) *mf,
  * This is very similar to bt_matchfinder_get_matches() because both functions
  * must do hashing and tree re-rooting.
  */
-static inline void
+static forceinline void
 TEMPLATED(bt_matchfinder_skip_position)(struct TEMPLATED(bt_matchfinder) *mf,
                                        const u8 *in_begin,
                                        ptrdiff_t cur_pos,
-                                       u32 max_len,
                                        u32 nice_len,
                                        u32 max_search_depth,
                                        u32 next_hashes[static 2])
@@ -356,7 +364,7 @@ TEMPLATED(bt_matchfinder_skip_position)(struct TEMPLATED(bt_matchfinder) *mf,
        TEMPLATED(bt_matchfinder_advance_one_byte)(mf,
                                                   in_begin,
                                                   cur_pos,
-                                                  max_len,
+                                                  nice_len,
                                                   nice_len,
                                                   max_search_depth,
                                                   next_hashes,