mirror of
https://github.com/X11Libre/xserver.git
synced 2026-10-04 22:36:10 +00:00
Make GLX byteswap macros more portable
- Use autoconf tests instead of platform-specific #ifdef's to decide which macros to use. - Provide fallbacks for platforms like Solaris that don't provide any of the existing known forms.
This commit is contained in:
parent
66fa87292e
commit
2fd4626fa6
7 changed files with 146 additions and 45 deletions
|
|
@ -46,18 +46,22 @@
|
|||
#include "dispatch.h"
|
||||
#include "glapioffsets.h"
|
||||
|
||||
#if defined(__linux__) || defined (__GLIBC__) || defined (__GNU__)
|
||||
#if defined(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
|
||||
|
||||
static int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc,
|
||||
|
|
|
|||
Loading…
Reference in a new issue