mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 09:14:04 +02:00
introduce MA_COMPILER_HAS_BUILTIN macro
Both GCC and Clang can use this feature, so let's make it more general. I didn't touch the dr_wav/dr_flac parts using this, since I figure the amalgamated miniaudio.h header isn't the primary source for those. Signed-off-by: Steven Noonan <steven@uplinklabs.net>
This commit is contained in:
+13
-10
@@ -6734,22 +6734,25 @@ static MA_INLINE ma_bool32 ma_has_neon(void)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__has_builtin)
|
||||||
|
#define MA_COMPILER_HAS_BUILTIN(x) __has_builtin(x)
|
||||||
|
#else
|
||||||
|
#define MA_COMPILER_HAS_BUILTIN(x) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||||
#define MA_HAS_BYTESWAP16_INTRINSIC
|
#define MA_HAS_BYTESWAP16_INTRINSIC
|
||||||
#define MA_HAS_BYTESWAP32_INTRINSIC
|
#define MA_HAS_BYTESWAP32_INTRINSIC
|
||||||
#define MA_HAS_BYTESWAP64_INTRINSIC
|
#define MA_HAS_BYTESWAP64_INTRINSIC
|
||||||
#elif defined(__clang__)
|
#elif defined(__clang__)
|
||||||
#if defined(__has_builtin)
|
#if MA_COMPILER_HAS_BUILTIN(__builtin_bswap16)
|
||||||
#if __has_builtin(__builtin_bswap16)
|
#define MA_HAS_BYTESWAP16_INTRINSIC
|
||||||
#define MA_HAS_BYTESWAP16_INTRINSIC
|
#endif
|
||||||
#endif
|
#if MA_COMPILER_HAS_BUILTIN(__builtin_bswap32)
|
||||||
#if __has_builtin(__builtin_bswap32)
|
#define MA_HAS_BYTESWAP32_INTRINSIC
|
||||||
#define MA_HAS_BYTESWAP32_INTRINSIC
|
#endif
|
||||||
#endif
|
#if MA_COMPILER_HAS_BUILTIN(__builtin_bswap64)
|
||||||
#if __has_builtin(__builtin_bswap64)
|
#define MA_HAS_BYTESWAP64_INTRINSIC
|
||||||
#define MA_HAS_BYTESWAP64_INTRINSIC
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
||||||
|
|||||||
Reference in New Issue
Block a user