From 83ee97498db28cb3e092f26f1a9169fbff1b1c6e Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 30 Oct 2008 13:24:13 +0100 Subject: 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 --- include/internal/internal.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') 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) + #endif -- cgit v1.2.3