X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=include%2Fwimlib%2Flz_extend.h;h=26f0ce5cd11be42f76bbee3508d16e6c119d9772;hp=2fb76bc921d47c5b1986c087b1e12e24cd7b62ac;hb=4a20aae0dd8469a352517a0b107416ffa99ccc55;hpb=0ec3ead8ebd29703e12342c56b282ae37b188e6d diff --git a/include/wimlib/lz_extend.h b/include/wimlib/lz_extend.h index 2fb76bc9..26f0ce5c 100644 --- a/include/wimlib/lz_extend.h +++ b/include/wimlib/lz_extend.h @@ -28,21 +28,21 @@ * Return the number of bytes at @matchptr that match the bytes at @strptr, up * to a maximum of @max_len. Initially, @len bytes are matched. */ -static inline u32 +static forceinline u32 lz_extend(const u8 * const strptr, const u8 * const matchptr, u32 len, const u32 max_len) { - while (UNALIGNED_ACCESS_IS_FAST && len + WORDSIZE <= max_len) { + while (UNALIGNED_ACCESS_IS_FAST && len + WORDBYTES <= max_len) { machine_word_t v = load_word_unaligned(matchptr + len) ^ load_word_unaligned(strptr + len); if (v != 0) { if (CPU_IS_LITTLE_ENDIAN) - len += ffsw(v) >> 3; + len += bsfw(v) >> 3; else - len += (8 * WORDSIZE - 1 - flsw(v)) >> 3; + len += (WORDBITS - 1 - bsrw(v)) >> 3; return len; } - len += WORDSIZE; + len += WORDBYTES; } while (len < max_len && matchptr[len] == strptr[len])