diff options
author | Eric Anholt <eric@anholt.net> | 2017-03-27 14:21:43 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2017-04-21 11:39:10 -0700 |
commit | be80a3cb48a7860b9ed985b123f4d8a3b4ae3c89 (patch) | |
tree | 8e12a12de779f59e708997e50d48daa10cec5688 /glx | |
parent | dae97e1bb4d4f86db118c22dfeea0eef0d3f8bdd (diff) |
glx: Use the same endian swapping as the rest of the server.
This dumps a ton of configure-time checks for system endian macros.
Given that we're marking the mixed-endian fixup code as cold, getting
at the system macros is a waste of code.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'glx')
-rw-r--r-- | glx/glxbyteorder.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/glx/glxbyteorder.h b/glx/glxbyteorder.h index aa88b44b9..5e94e8626 100644 --- a/glx/glxbyteorder.h +++ b/glx/glxbyteorder.h @@ -35,27 +35,27 @@ #include <dix-config.h> #endif -#if HAVE_BYTESWAP_H -#include <byteswap.h> -#elif defined(USE_SYS_ENDIAN_H) -#include <sys/endian.h> -#elif defined(__APPLE__) -#include <libkern/OSByteOrder.h> -#define bswap_16 OSSwapInt16 -#define bswap_32 OSSwapInt32 -#define bswap_64 OSSwapInt64 -#else -#define bswap_16(value) \ - ((((value) & 0xff) << 8) | ((value) >> 8)) +#include "misc.h" -#define bswap_32(value) \ - (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \ - (uint32_t)bswap_16((uint16_t)((value) >> 16))) +static inline uint16_t +bswap_16(uint16_t val) +{ + swap_uint16(&val); + return val; +} -#define bswap_64(value) \ - (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \ - << 32) | \ - (uint64_t)bswap_32((uint32_t)((value) >> 32))) -#endif +static inline uint32_t +bswap_32(uint32_t val) +{ + swap_uint32(&val); + return val; +} + +static inline uint64_t +bswap_64(uint64_t val) +{ + swap_uint64(&val); + return val; +} #endif /* !defined(__GLXBYTEORDER_H__) */ |