aboutsummaryrefslogtreecommitdiffstats
path: root/src/apk_defines.h
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-07-14 14:08:15 +0300
committerTimo Teras <timo.teras@iki.fi>2009-07-14 14:08:15 +0300
commite98d8253b951e048c18dab5ea06a8bad5ebb522b (patch)
tree9caec6280b0a95d593b4c1feeb3b9f4a1bf85614 /src/apk_defines.h
parent8d1eeb58e450ef4a81497c3233a929350af3e467 (diff)
downloadaports-e98d8253b951e048c18dab5ea06a8bad5ebb522b.tar.bz2
aports-e98d8253b951e048c18dab5ea06a8bad5ebb522b.tar.xz
blob: add some likelyness to help compiler optimizations
Diffstat (limited to 'src/apk_defines.h')
-rw-r--r--src/apk_defines.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/apk_defines.h b/src/apk_defines.h
index 49ca9ebf98..c8a3622f2a 100644
--- a/src/apk_defines.h
+++ b/src/apk_defines.h
@@ -30,6 +30,18 @@
#define NULL 0L
#endif
+#if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ < 96
+#define __builtin_expect(x, expected_value) (x)
+#endif
+
+#ifndef likely
+#define likely(x) __builtin_expect((!!(x)),1)
+#endif
+
+#ifndef unlikely
+#define unlikely(x) __builtin_expect((!!(x)),0)
+#endif
+
#ifndef container_of
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \