path: root/include
diff options
authorPablo Neira Ayuso <>2008-10-30 13:24:13 +0100
committerPablo Neira Ayuso <>2008-10-30 13:24:13 +0100
commit83ee97498db28cb3e092f26f1a9169fbff1b1c6e (patch)
tree0eaec2083184795dc47437792976be5c6fa09dd2 /include
parent93c459d603cc7a3d9cadeb0844364d5e59aa267c (diff)
API: use of __builtin_expect in error checking paths
This patch introduces likely() and unlikely() that use __builtin_expect to assist the compiler in the branch decisions. I am assuming that we have no clients of libnetfilter_conntrack that use gcc < 2.96. Signed-off-by: Pablo Neira Ayuso <>
Diffstat (limited to 'include')
1 files changed, 3 insertions, 0 deletions
diff --git a/include/internal/internal.h b/include/internal/internal.h
index e7fc22e..37e4143 100644
--- a/include/internal/internal.h
+++ b/include/internal/internal.h
@@ -72,4 +72,7 @@
#define TUPLE_SET(dir) (dir == __DIR_ORIG ? TS_ORIG : TS_REPL)
+#define likely(x) __builtin_expect((x),1)
+#define unlikely(x) __builtin_expect((x),0)