diff options
author | Timo Teras <timo.teras@iki.fi> | 2009-07-14 14:08:15 +0300 |
---|---|---|
committer | Timo Teras <timo.teras@iki.fi> | 2009-07-14 14:08:15 +0300 |
commit | e98d8253b951e048c18dab5ea06a8bad5ebb522b (patch) | |
tree | 9caec6280b0a95d593b4c1feeb3b9f4a1bf85614 /src/apk_defines.h | |
parent | 8d1eeb58e450ef4a81497c3233a929350af3e467 (diff) | |
download | aports-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.h | 12 |
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); \ |