X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/blobdiff_plain/67b5031ec6d160b5cae425466a34d1be3b211dd4..c91413e6acbc8d157ff52ceb8cd78cee97403584:/utils/bits.h?ds=sidebyside diff --git a/utils/bits.h b/utils/bits.h index 656eee5..4d1d61a 100644 --- a/utils/bits.h +++ b/utils/bits.h @@ -320,13 +320,13 @@ typedef unsigned char octet, uint8; /* --- Endianness swapping --- */ -#if GCC_VERSION_P(4, 8) +#if GCC_VERSION_P(4, 8) || CLANG_VERSION_P(3, 2) # define ENDSWAP16(x) ((uint16)__builtin_bswap16(x)) #endif -#if GCC_VERSION_P(4, 3) +#if GCC_VERSION_P(4, 3) || CLANG_VERSION_P(3, 2) # define ENDSWAP32(x) ((uint32)__builtin_bswap32(x)) #endif -#if GCC_VERSION_P(4, 3) && defined(HAVE_UINT64) +#if (GCC_VERSION_P(4, 3) || CLANG_VERSION_P(3, 2)) && defined(HAVE_UINT64) # define ENDSWAP64(x) ((uint64)__builtin_bswap64(x)) #endif @@ -427,7 +427,7 @@ typedef unsigned char octet, uint8; /* --- Unaligned access (GCC-specific) --- */ -#if GCC_VERSION_P(3, 3) && CHAR_BIT == 8 +#if (GCC_VERSION_P(3, 3) || CLANG_VERSION_P(3, 0)) && CHAR_BIT == 8 # define MLIB_MISALIGNED __attribute__((aligned(1), may_alias)) # if __SIZEOF_SHORT__ == 2 typedef MLIB_MISALIGNED unsigned short misaligned_uint16;