From f41df2ac2fed347d3f107f3533e76e000d29c6cb Mon Sep 17 00:00:00 2001 From: Jia Tan Date: Wed, 19 Apr 2023 22:22:16 +0800 Subject: Windows: Include when needed. Legacy Windows did not need to #include 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 when it will is actually needed. --- src/liblzma/common/memcmplen.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/liblzma/common') diff --git a/src/liblzma/common/memcmplen.h b/src/liblzma/common/memcmplen.h index 5372cfa8..db3fff60 100644 --- a/src/liblzma/common/memcmplen.h +++ b/src/liblzma/common/memcmplen.h @@ -19,6 +19,16 @@ # include #endif +// Only include 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 +#endif + /// Find out how many equal bytes the two buffers have. /// -- cgit v1.2.3