diff options
author | Ian Romanick <idr@us.ibm.com> | 2007-01-04 15:37:33 -0800 |
---|---|---|
committer | Ian Romanick <idr@us.ibm.com> | 2007-01-04 15:37:33 -0800 |
commit | b7ca5d14ce7ba410b0dab5c2289f6d7b75e763df (patch) | |
tree | be770a26b61f5852904bd4449f9d7e6f06824f85 /GL | |
parent | 8dd5771a1b91c331860b667fb18e484452000aad (diff) |
Incorporate new byte-order related configure changes.
Diffstat (limited to 'GL')
-rw-r--r-- | GL/glx/glxbyteorder.h | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/GL/glx/glxbyteorder.h b/GL/glx/glxbyteorder.h index 3c094d702..0bcb91fb7 100644 --- a/GL/glx/glxbyteorder.h +++ b/GL/glx/glxbyteorder.h @@ -31,18 +31,25 @@ #if !defined(__GLXBYTEORDER_H__) #define __GLXBYTEORDER_H__ -#if defined(__linux__) || defined(__GLIBC__) || defined(__GNU__) +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#if HAVE_BYTESWAP_H #include <byteswap.h> -#elif defined(__OpenBSD__) +#elif defined(USE_SYS_ENDIAN_H) #include <sys/endian.h> -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 -#else -#include <sys/endian.h> -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 +#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 #endif /* !defined(__GLXBYTEORDER_H__) */ |