From 52459745ec05de88adbc087e9566fe6d97ef424b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 25 Jun 2008 17:09:11 +1000 Subject: ati: hopefully fix byteswap mess for those other OSes. --- src/radeon_macros.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') 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 +#elif defined(USE_SYS_ENDIAN_H) +#include +#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) -- cgit v1.2.3