12#ifndef LZMA_MEMCMPLEN_H
13#define LZMA_MEMCMPLEN_H
17#ifdef HAVE_IMMINTRIN_H
18# include <immintrin.h>
24#if defined(TUKLIB_FAST_UNALIGNED_ACCESS) \
25 && defined(_MSC_VER) \
27 || defined(_M_ARM64) || defined(_M_ARM64EC)) \
28 && !defined(__INTEL_COMPILER)
53lzma_memcmplen(
const uint8_t *buf1,
const uint8_t *
buf2,
59#if defined(TUKLIB_FAST_UNALIGNED_ACCESS) \
60 && (((TUKLIB_GNUC_REQ(3, 4) || defined(__clang__)) \
61 && (defined(__x86_64__) \
62 || defined(__aarch64__))) \
63 || (defined(__INTEL_COMPILER) && defined(__x86_64__)) \
64 || (defined(__INTEL_COMPILER) && defined(_M_X64)) \
65 || (defined(_MSC_VER) && (defined(_M_X64) \
66 || defined(_M_ARM64) || defined(_M_ARM64EC))))
83#define LZMA_MEMCMPLEN_EXTRA 8
88# if defined(_MSC_VER) || defined(__INTEL_COMPILER)
90 _BitScanForward64(&tmp, x);
91 len += (uint32_t)tmp >> 3;
94 len += (uint32_t)__builtin_ctzll(x) >> 3;
104#elif defined(TUKLIB_FAST_UNALIGNED_ACCESS) \
105 && defined(HAVE__MM_MOVEMASK_EPI8) \
106 && (defined(__SSE2__) \
107 || (defined(_MSC_VER) && defined(_M_IX86_FP) \
117# define LZMA_MEMCMPLEN_EXTRA 16
119 const uint32_t x = 0xFFFF ^ (uint32_t)_mm_movemask_epi8(
121 _mm_loadu_si128((
const __m128i *)(buf1 +
len)),
122 _mm_loadu_si128((
const __m128i *)(
buf2 +
len))));
134#elif defined(TUKLIB_FAST_UNALIGNED_ACCESS) && !defined(WORDS_BIGENDIAN)
136# define LZMA_MEMCMPLEN_EXTRA 4
140 if ((x & 0xFFFF) == 0) {
156#elif defined(TUKLIB_FAST_UNALIGNED_ACCESS) && defined(WORDS_BIGENDIAN)
158# define LZMA_MEMCMPLEN_EXTRA 4
162 if ((x & 0xFFFF0000) == 0) {
167 if ((x & 0xFF000000) == 0)
180# define LZMA_MEMCMPLEN_EXTRA 0
#define assert(condition)
Definition lz4.c:273
Definitions common to the whole liblzma library.
#define lzma_always_inline
Definition common.h:114
#define UINT32_MAX
Definition lzma.h:158
#define my_min(x, y)
Definition sysdefs.h:185
static uint32_t const uint8_t uint32_t len
Definition memcmplen.h:44
static uint32_t const uint8_t * buf2
Definition memcmplen.h:43
static uint32_t const uint8_t uint32_t uint32_t limit
Definition memcmplen.h:45
#define read32ne
Definition tuklib_integer.h:467
#define read64ne
Definition tuklib_integer.h:468