diff --git a/configure.ac b/configure.ac index 5b71386..b24b2f7 100644 --- a/configure.ac +++ b/configure.ac @@ -157,66 +157,6 @@ XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS" AC_CHECK_HEADERS([dev/wscons/wsconsio.h]) -# Checks for headers/macros for byte swapping -# Known variants: -# bswap_16, bswap_32, bswap_64 (glibc) -# __swap16, __swap32, __swap64 (OpenBSD) -# bswap16, bswap32, bswap64 (other BSD's) -# and a fallback to local macros if none of the above are found - -# if is found, assume it's the correct version -AC_CHECK_HEADERS([byteswap.h]) - -# if is found, have to check which version -AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="no"]) - -if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then - AC_MSG_CHECKING([for __swap16 variant of byteswapping macros]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([ -#include -#include - ], [ -int a = 1, b; -b = __swap16(a); - ]) -], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no']) - AC_MSG_RESULT([$SYS_ENDIAN__SWAP]) - - AC_MSG_CHECKING([for bswap16 variant of byteswapping macros]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([ -#include -#include - ], [ -int a = 1, b; -b = bswap16(a); - ]) -], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no']) - AC_MSG_RESULT([$SYS_ENDIAN_BSWAP]) - - if test "$SYS_ENDIAN_BSWAP" = "yes" ; then - USE_SYS_ENDIAN_H=yes - BSWAP=bswap - else - if test "$SYS_ENDIAN__SWAP" = "yes" ; then - USE_SYS_ENDIAN_H=yes - BSWAP=__swap - else - USE_SYS_ENDIAN_H=no - fi - fi - - if test "$USE_SYS_ENDIAN_H" = "yes" ; then - AC_DEFINE([USE_SYS_ENDIAN_H], 1, - [Define to use byteswap macros from ]) - AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, - [Define to 16-bit byteswap macro]) - AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, - [Define to 32-bit byteswap macro]) - AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, - [Define to 64-bit byteswap macro]) - fi -fi - AC_SUBST([moduledir]) AC_CONFIG_FILES([Makefile src/Makefile man/Makefile]) diff --git a/src/r128.h b/src/r128.h index 80a9e15..590ef92 100644 --- a/src/r128.h +++ b/src/r128.h @@ -77,34 +77,10 @@ #include "r128_probe.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) -#define le16_to_cpu(x) bswap_16(x) #define cpu_to_le32(x) bswap_32(x) -#define cpu_to_le16(x) bswap_16(x) #else -#define le32_to_cpu(x) (x) -#define le16_to_cpu(x) (x) #define cpu_to_le32(x) (x) -#define cpu_to_le16(x) (x) #endif #define R128_DEBUG 0 /* Turn off debugging output */