1
0
zrcadlo https://git.tukaani.org/xz.git synchronizováno 2025-10-23 09:32:55 +00:00

Windows: Include <intrin.h> when needed.

Legacy Windows did not need to #include <intrin.h> to use the MSVC
intrinsics. Newer versions likely just issue a warning, but the MSVC
documentation says to include the header file for the intrinsics we use.

GCC and Clang can "pretend" to be MSVC on Windows, so extra checks are
needed in tuklib_integer.h to only include <intrin.h> when it will is
actually needed.
Tento commit je obsažen v:
Jia Tan 2023-04-19 22:22:16 +08:00
rodič 7062348bf3
revize f41df2ac2f
2 změnil soubory, kde provedl 16 přidání a 0 odebrání

Zobrazit soubor

@ -52,6 +52,12 @@
// and such functions.
#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500)
# include <immintrin.h>
// Only include <intrin.h> when it is needed. GCC and Clang can both
// use __builtin's, so we only need Windows instrincs when using MSVC.
// GCC and Clang can set _MSC_VER on Windows, so we need to exclude these
// cases explicitly.
#elif defined(_MSC_VER) && !TUKLIB_GNUC_REQ(3, 4) && !defined(__clang__)
# include <intrin.h>
#endif

Zobrazit soubor

@ -19,6 +19,16 @@
# include <immintrin.h>
#endif
// Only include <intrin.h> if it is needed. The header is only needed
// on Windows when using an MSVC compatible compiler. The Intel compiler
// can use the intrinsics without the header file.
#if defined(TUKLIB_FAST_UNALIGNED_ACCESS) \
&& (defined(_MSC_VER) \
&& defined(_M_X64) \
&& !defined(__INTEL_COMPILER))
# include <intrin.h>
#endif
/// Find out how many equal bytes the two buffers have.
///