Incorporate new byte-order related configure changes.

This commit is contained in:
Ian Romanick 2007-01-04 15:37:33 -08:00
parent 8dd5771a1b
commit b7ca5d14ce

View File

@ -31,18 +31,25 @@
#if !defined(__GLXBYTEORDER_H__) #if !defined(__GLXBYTEORDER_H__)
#define __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> #include <byteswap.h>
#elif defined(__OpenBSD__) #elif defined(USE_SYS_ENDIAN_H)
#include <sys/endian.h> #include <sys/endian.h>
#define bswap_16 __swap16 #define bswap_16(value) \
#define bswap_32 __swap32 ((((value) & 0xff) << 8) | ((value) >> 8))
#define bswap_64 __swap64
#else #define bswap_32(value) \
#include <sys/endian.h> (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \
#define bswap_16 bswap16 (uint32_t)bswap_16((uint16_t)((value) >> 16)))
#define bswap_32 bswap32
#define bswap_64 bswap64 #define bswap_64(value) \
(((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \
<< 32) | \
(uint64_t)bswap_32((uint32_t)((value) >> 32)))
#endif #endif
#endif /* !defined(__GLXBYTEORDER_H__) */ #endif /* !defined(__GLXBYTEORDER_H__) */