From: Daniel Gurney Date: Wed, 11 Nov 2020 08:32:27 +0000 (+0200) Subject: compat/bswap.h: don't assume MSVC is little-endian X-Git-Tag: v2.30.0-rc0~81^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0c038fc65a2c2792de3fbe71f85ace4c0292d71c;p=thirdparty%2Fgit.git compat/bswap.h: don't assume MSVC is little-endian In 1af265f0 (compat/bswap.h: simplify MSVC endianness detection, 2020-11-08) we attempted to simplify code by assuming MSVC builds will be for little-endian machines, since only unusably old versions of MSVC supported big-endian MIPS and m68k architectures. However, it's possible that MSVC could be ported to build for a big-endian architecture again, so the simplification wasn't as future-proof as hoped. So let's go back to the old way of detecting MSVC, and then checking architecture from a list of little-endian architecture macros. Note that MSVC does not treat ARM64 as bi-endian, so we can safely treat it as little-endian. Helped-by: brian m. carlson Helped-by: Jeff King Helped-by: Johannes Schindelin Helped-by: Junio C Hamano Signed-off-by: Daniel Gurney Signed-off-by: Junio C Hamano --- diff --git a/compat/bswap.h b/compat/bswap.h index 72f225eaa8..512f6f4b99 100644 --- a/compat/bswap.h +++ b/compat/bswap.h @@ -74,7 +74,7 @@ static inline uint64_t git_bswap64(uint64_t x) } #endif -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64)) #include