mirror of
https://github.com/git/git.git
synced 2026-01-11 21:33:13 +09:00
bswap.h: define GIT_LITTLE_ENDIAN on msvc as little endian
The Microsoft Visual C++ (MSVC) compiler (as of Visual Studio 2022 version 17.13.6) does not define __BYTE_ORDER__ and its C-library does not define __BYTE_ORDER. The compiler is supported only on arm64 and x86 which are all little endian. Define GIT_BYTE_ORDER on msvc as little endian to avoid further checks. Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f1b8524303
commit
30dea7ddf7
@ -81,6 +81,10 @@ static inline uint64_t git_bswap64(uint64_t x)
|
||||
#define bswap32(x) _byteswap_ulong(x)
|
||||
#define bswap64(x) _byteswap_uint64(x)
|
||||
|
||||
#define GIT_LITTLE_ENDIAN 1234
|
||||
#define GIT_BIG_ENDIAN 4321
|
||||
#define GIT_BYTE_ORDER GIT_LITTLE_ENDIAN
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(bswap32)
|
||||
@ -122,7 +126,7 @@ static inline uint64_t git_bswap64(uint64_t x)
|
||||
# define GIT_LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
|
||||
# define GIT_BIG_ENDIAN __ORDER_BIG_ENDIAN__
|
||||
|
||||
#else
|
||||
#elif !defined(GIT_BYTE_ORDER)
|
||||
|
||||
# define GIT_BIG_ENDIAN 4321
|
||||
# define GIT_LITTLE_ENDIAN 1234
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user