]> wimlib.net Git - wimlib/blobdiff - include/wimlib/hc_matchfinder.h
Use memcpy() for unaligned accesses
[wimlib] / include / wimlib / hc_matchfinder.h
index 1f552db2e73bcccd2550a747720938343cf9fc52..b0c8c65a44acf09ad4efba0889b275ce0a4b4b46 100644 (file)
@@ -141,7 +141,7 @@ struct TEMPLATED(hc_matchfinder) {
 
 /* Return the number of bytes that must be allocated for a 'hc_matchfinder' that
  * can work with buffers up to the specified size.  */
-static inline size_t
+static forceinline size_t
 TEMPLATED(hc_matchfinder_size)(size_t max_bufsize)
 {
        return sizeof(struct TEMPLATED(hc_matchfinder)) +
@@ -149,7 +149,7 @@ TEMPLATED(hc_matchfinder_size)(size_t max_bufsize)
 }
 
 /* Prepare the matchfinder for a new input buffer.  */
-static inline void
+static forceinline void
 TEMPLATED(hc_matchfinder_init)(struct TEMPLATED(hc_matchfinder) *mf)
 {
        memset(mf, 0, sizeof(*mf));
@@ -184,7 +184,7 @@ TEMPLATED(hc_matchfinder_init)(struct TEMPLATED(hc_matchfinder) *mf)
  * Return the length of the match found, or 'best_len' if no match longer than
  * 'best_len' was found.
  */
-static inline u32
+static forceinline u32
 TEMPLATED(hc_matchfinder_longest_match)(struct TEMPLATED(hc_matchfinder) * const restrict mf,
                                        const u8 * const restrict in_begin,
                                        const ptrdiff_t cur_pos,
@@ -197,7 +197,7 @@ TEMPLATED(hc_matchfinder_longest_match)(struct TEMPLATED(hc_matchfinder) * const
 {
        const u8 *in_next = in_begin + cur_pos;
        u32 depth_remaining = max_search_depth;
-       const u8 *best_matchptr = best_matchptr; /* uninitialized */
+       const u8 *best_matchptr = in_next;
        mf_pos_t cur_node3, cur_node4;
        u32 hash3, hash4;
        u32 next_seq3, next_seq4;
@@ -353,7 +353,7 @@ out:
  *
  * Returns @in_next + @count.
  */
-static inline const u8 *
+static forceinline const u8 *
 TEMPLATED(hc_matchfinder_skip_positions)(struct TEMPLATED(hc_matchfinder) * const restrict mf,
                                         const u8 * const restrict in_begin,
                                         const ptrdiff_t cur_pos,