X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fcompiler.h;h=760389d58461d2474249598301e2e5525ed91d52;hb=620606f63cc56c7541005dc6787106789e2c364e;hp=27612a74a8efb21618f9685e7439cf7fe1cbcb70;hpb=1e3f34c7693bcabae8e443ac1b246680ef9b60e2;p=sliver-openvswitch.git diff --git a/lib/compiler.h b/lib/compiler.h index 27612a74a..760389d58 100644 --- a/lib/compiler.h +++ b/lib/compiler.h @@ -26,6 +26,8 @@ #define ALWAYS_INLINE __attribute__((always_inline)) #define WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) #define SENTINEL(N) __attribute__((sentinel(N))) +#define OVS_LIKELY(CONDITION) __builtin_expect(!!(CONDITION), 1) +#define OVS_UNLIKELY(CONDITION) __builtin_expect(!!(CONDITION), 0) #else #define NO_RETURN #define OVS_UNUSED @@ -35,6 +37,8 @@ #define ALWAYS_INLINE #define WARN_UNUSED_RESULT #define SENTINEL(N) +#define OVS_LIKELY(CONDITION) (!!(CONDITION)) +#define OVS_UNLIKELY(CONDITION) (!!(CONDITION)) #endif /* ISO C says that a C implementation may choose any integer type for an enum