aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2016-02-19 22:23:32 -0800
committerAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2016-02-27 09:05:54 -0800
commitd8c09b5bebe3873a522e5dee920fba86ed46f9b9 (patch)
tree019e2b1bf6024b0b27c2221259b057e21873eb15
parent6d7c19f5759eac6f9ac8014b4bcdb8cb9b059bb7 (diff)
downloadpaludis-d8c09b5bebe3873a522e5dee920fba86ed46f9b9.tar.gz
paludis-d8c09b5bebe3873a522e5dee920fba86ed46f9b9.tar.xz
clean up custom endian detection
Use compiler provided infrastructure for detecting the endian. This has been supported in GCC since 4.6.
-rw-r--r--configure.ac8
-rw-r--r--paludis/util/byte_swap.hh2
-rw-r--r--paludis/util/elf.cc2
-rw-r--r--paludis/util/whirlpool.cc2
4 files changed, 3 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac
index 7c1fe4f..4c480a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,14 +89,6 @@ dnl {{{ make pkg-config work... dumb macro...
PKG_PROG_PKG_CONFIG([0.9.0])
dnl }}}
-dnl {{{ check for byte order
-AC_C_BIGENDIAN
-if test "x$ac_cv_c_bigendian" = "xyes"; then
- PALUDIS_CXXFLAGS="${PALUDIS_CXXFLAGS} -DPALUDIS_BIG_ENDIAN=1"
- PALUDIS_PC_CFLAGS="${PALUDIS_PC_CFLAGS} -DPALUDIS_BIG_ENDIAN=1"
-fi
-dnl }}}
-
need_xml_check=
need_pcrecpp_check=
need_libarchive_check=
diff --git a/paludis/util/byte_swap.hh b/paludis/util/byte_swap.hh
index 2ba7786..4ba744c 100644
--- a/paludis/util/byte_swap.hh
+++ b/paludis/util/byte_swap.hh
@@ -76,7 +76,7 @@ namespace paludis
return byte_swap_internals::ByteSwap<sizeof(T_), T_>::swap(x);
}
-#ifdef PALUDIS_BIG_ENDIAN
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
template <typename T_>
inline T_
from_bigendian(T_ x)
diff --git a/paludis/util/elf.cc b/paludis/util/elf.cc
index 3508f8f..f7a0a6f 100644
--- a/paludis/util/elf.cc
+++ b/paludis/util/elf.cc
@@ -59,7 +59,7 @@ namespace paludis
enum {
native_byte_order =
-#ifdef PALUDIS_BIG_ENDIAN
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
ELFDATA2MSB
#else
ELFDATA2LSB
diff --git a/paludis/util/whirlpool.cc b/paludis/util/whirlpool.cc
index 1481fef..bbf4089 100644
--- a/paludis/util/whirlpool.cc
+++ b/paludis/util/whirlpool.cc
@@ -213,7 +213,7 @@ namespace
{
// GCC isn't clever enough to optimise the big endian version combined with
// from_bigendian, so do it manually.
-#ifdef PALUDIS_BIG_ENDIAN
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
return (_a((i - j + 8) % 8) >> ((7 - j) * 8)) & 0xFF;
#else
return (_a((i - j + 8) % 8) >> ( j * 8)) & 0xFF;