提交 0fcabdeb 编写于 作者: S Sebastian Schuberth 提交者: Junio C Hamano

Use faster byte swapping when compiling with MSVC

When compiling with MSVC on x86-compatible, use an intrinsic for byte swapping.
In contrast to the GCC path, we do not prefer inline assembly here as it is not
supported for the x64 platform.
Signed-off-by: NSebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 cd0f8e6d
......@@ -28,6 +28,16 @@ static inline uint32_t default_swab32(uint32_t val)
} \
__res; })
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
#include <stdlib.h>
#define bswap32(x) _byteswap_ulong(x)
#endif
#ifdef bswap32
#undef ntohl
#undef htonl
#define ntohl(x) bswap32(x)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册