aboutsummaryrefslogtreecommitdiff
path: root/miner.h
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2011-02-17 01:22:55 -0500
committerJeff Garzik <jgarzik@redhat.com>2011-02-17 01:22:55 -0500
commit1083e15c47539133a0e5075bb3d9f2b7741633f3 (patch)
treedc8a1fbf3098720fd31ba6f33ce36680267cb9e2 /miner.h
parentf0bdc0b6f9f19c603f5e34332fa0d4e5bb3ea973 (diff)
Mark hash success as unlikely, using __builtin_expect() intrinsic
Diffstat (limited to 'miner.h')
-rw-r--r--miner.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/miner.h b/miner.h
index b396380..1c73114 100644
--- a/miner.h
+++ b/miner.h
@@ -21,6 +21,14 @@
#include <byteswap.h>
#endif
+#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
+#undef unlikely
+#define unlikely(expr) (__builtin_expect((expr), 0))
+#else
+#undef unlikely
+#define unlikely(expr) (expr)
+#endif
+
#if defined(__i386__)
#define WANT_CRYPTOPP_ASM32
#endif