summaryrefslogtreecommitdiff
path: root/Xfuncproto.h.in
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2006-10-26 00:45:36 +0300
committerDaniel Stone <daniels@endtroducing.fooishbar.org>2006-10-26 00:45:36 +0300
commitab484c934301a61edc66dc1e4f554ec97b53aaf8 (patch)
tree8a9ac153b75ae3052cbc27cfaf284b47ebc20d35 /Xfuncproto.h.in
parent178cae180bc8b2e8feaaeda6d7c0317cf2715e14 (diff)
Xfuncproto: add _X_LIKELY and _X_UNLIKELY
Add gcc branch hinting annotations.
Diffstat (limited to 'Xfuncproto.h.in')
-rw-r--r--Xfuncproto.h.in6
1 files changed, 6 insertions, 0 deletions
diff --git a/Xfuncproto.h.in b/Xfuncproto.h.in
index ef9702f..e8f02be 100644
--- a/Xfuncproto.h.in
+++ b/Xfuncproto.h.in
@@ -89,16 +89,22 @@ in this Software without prior written authorization from The Open Group.
# define _X_EXPORT __attribute__((visibility("default")))
# define _X_HIDDEN __attribute__((visibility("hidden")))
# define _X_INTERNAL __attribute__((visibility("internal")))
+# define _X_LIKELY(x) __builtin_expect(!!(x), 1)
+# define _X_UNLIKELY(x) __builtin_expect(!!(x), 0)
# define _X_INLINE inline
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
# define _X_EXPORT __global
# define _X_HIDDEN __hidden
# define _X_INTERNAL __hidden
+# define _X_LIKELY(x) (x)
+# define _X_UNLIKELY(x) (x)
# define _X_INLINE inline
#else /* not gcc >= 3.3 and not Sun Studio >= 8 */
# define _X_EXPORT
# define _X_HIDDEN
# define _X_INTERNAL
+# define _X_LIKELY(x) (x)
+# define _X_UNLIKELY(x) (x)
# define _X_INLINE
#endif