diff options
Diffstat (limited to 'src/radeon_macros.h')
-rw-r--r-- | src/radeon_macros.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/radeon_macros.h b/src/radeon_macros.h index 3675dc51..afe442ea 100644 --- a/src/radeon_macros.h +++ b/src/radeon_macros.h @@ -51,7 +51,23 @@ #include "compiler.h" +#if HAVE_BYTESWAP_H #include <byteswap.h> +#elif defined(USE_SYS_ENDIAN_H) +#include <sys/endian.h> +#else +#define bswap_16(value) \ + ((((value) & 0xff) << 8) | ((value) >> 8)) + +#define bswap_32(value) \ + (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \ + (uint32_t)bswap_16((uint16_t)((value) >> 16))) + +#define bswap_64(value) \ + (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \ + << 32) | \ + (uint64_t)bswap_32((uint32_t)((value) >> 32))) +#endif #if X_BYTE_ORDER == X_BIG_ENDIAN #define le32_to_cpu(x) bswap_32(x) |