diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-05-05 14:56:24 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-05-05 14:56:24 -0700 |
| commit | b50795db7969712ef937906d548fe9eb58cb9fb5 (patch) | |
| tree | af44dbda9c227254aea1e7cd656a95362adbd6c6 /compat | |
| parent | 6c0bd1fc70efaf053abe4e57c976afdc72d15377 (diff) | |
| parent | 436a42215e51fa2f8b74d128472d7d9bfe2595e1 (diff) | |
Merge branch 'js/windows-arm64'
Update to arm64 Windows port.
* js/windows-arm64:
max_tree_depth: lower it for clangarm64 on Windows
mingw(arm64): do move the `/etc/git*` location
msvc: do handle builds on Windows/ARM64
mingw: do not use nedmalloc on Windows/ARM64
config.mak.uname: add support for clangarm64
bswap.h: add support for built-in bswap functions
Diffstat (limited to 'compat')
| -rw-r--r-- | compat/bswap.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/compat/bswap.h b/compat/bswap.h index b34054f2bd..9e0f98e00b 100644 --- a/compat/bswap.h +++ b/compat/bswap.h @@ -35,7 +35,19 @@ static inline uint64_t default_bswap64(uint64_t val) #undef bswap32 #undef bswap64 -#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +/** + * __has_builtin is available since Clang 10 and GCC 10. + * Below is a fallback for older compilers. + */ +#ifndef __has_builtin + #define __has_builtin(x) 0 +#endif + +#if __has_builtin(__builtin_bswap32) && __has_builtin(__builtin_bswap64) +#define bswap32(x) __builtin_bswap32((x)) +#define bswap64(x) __builtin_bswap64((x)) + +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) #define bswap32 git_bswap32 static inline uint32_t git_bswap32(uint32_t x) |
