aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2011-02-10 00:52:22 -0500
committerJeff Garzik <jgarzik@redhat.com>2011-02-10 00:52:22 -0500
commit9f3472ad19480ad54c34a01ddffb93ee439303da (patch)
tree3b839b2fc8ee74e2da1b2a264d27450bb1392d5c
parentc0935a94899bc7261bc98b17a52d7c11b005fde4 (diff)
Use bswap_32 from byteswap.h, if __builtin_bswap() is not available
-rw-r--r--miner.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/miner.h b/miner.h
index 314796b..b396380 100644
--- a/miner.h
+++ b/miner.h
@@ -15,6 +15,12 @@
#define WANT_VIA_PADLOCK 1
#endif
+#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
+#define WANT_BUILTIN_BSWAP
+#else
+#include <byteswap.h>
+#endif
+
#if defined(__i386__)
#define WANT_CRYPTOPP_ASM32
#endif
@@ -25,7 +31,11 @@
static inline uint32_t swab32(uint32_t v)
{
+#ifdef WANT_BUILTIN_BSWAP
return __builtin_bswap32(v);
+#else
+ return bswap_32(v);
+#endif
}
static inline void swap256(void *dest_p, const void *src_p)