diff options
Diffstat (limited to 'host/include/uhd/utils/byteswap.ipp')
-rw-r--r-- | host/include/uhd/utils/byteswap.ipp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/host/include/uhd/utils/byteswap.ipp b/host/include/uhd/utils/byteswap.ipp index 85c11b8f4..25f688693 100644 --- a/host/include/uhd/utils/byteswap.ipp +++ b/host/include/uhd/utils/byteswap.ipp @@ -29,39 +29,39 @@ UHD_INLINE uint64_t uhd::byteswap(uint64_t x) return _byteswap_uint64(x); } -#elif defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 +#elif defined(UHD_PLATFORM_MACOS) +# include <libkern/OSByteOrder.h> UHD_INLINE uint16_t uhd::byteswap(uint16_t x) { - return (x >> 8) | (x << 8); // DNE return __builtin_bswap16(x); + return OSSwapInt16(x); } UHD_INLINE uint32_t uhd::byteswap(uint32_t x) { - return __builtin_bswap32(x); + return OSSwapInt32(x); } UHD_INLINE uint64_t uhd::byteswap(uint64_t x) { - return __builtin_bswap64(x); + return OSSwapInt64(x); } -#elif defined(UHD_PLATFORM_MACOS) -# include <libkern/OSByteOrder.h> +#elif defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 UHD_INLINE uint16_t uhd::byteswap(uint16_t x) { - return OSSwapInt16(x); + return (x >> 8) | (x << 8); // DNE return __builtin_bswap16(x); } UHD_INLINE uint32_t uhd::byteswap(uint32_t x) { - return OSSwapInt32(x); + return __builtin_bswap32(x); } UHD_INLINE uint64_t uhd::byteswap(uint64_t x) { - return OSSwapInt64(x); + return __builtin_bswap64(x); } #elif defined(UHD_PLATFORM_LINUX) |