diff options
author | Lennart Poettering <lennart@poettering.net> | 2007-11-09 01:28:56 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2007-11-09 01:28:56 +0000 |
commit | c8cdb06135e2e316a724098e5c0af7aa9e81091e (patch) | |
tree | 101f464646ab03ee71673edcfbdfbe133bfde984 /src/pulsecore | |
parent | 14b974a6d870432554afc20710ad9f93f4833e88 (diff) |
add support for likely()/unlikely() type macros
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2032 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulsecore')
-rw-r--r-- | src/pulsecore/gccmacro.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/pulsecore/gccmacro.h b/src/pulsecore/gccmacro.h index e9f0d093..ecdc0578 100644 --- a/src/pulsecore/gccmacro.h +++ b/src/pulsecore/gccmacro.h @@ -60,7 +60,7 @@ #endif #ifndef PA_GCC_PURE -#ifdef __GNUCC__ +#ifdef __GNUC__ #define PA_GCC_PURE __attribute__ ((pure)) #else /** This function's return value depends only the arguments list and global state **/ @@ -69,7 +69,7 @@ #endif #ifndef PA_GCC_CONST -#ifdef __GNUCC__ +#ifdef __GNUC__ #define PA_GCC_CONST __attribute__ ((const)) #else /** This function's return value depends only the arguments list (stricter version of PA_GCC_PURE) **/ @@ -77,4 +77,14 @@ #endif #endif +#ifndef PA_LIKELY +#ifdef __GNUC__ +#define PA_LIKELY(x) __builtin_expect((x),1) +#define PA_UNLIKELY(x) __builtin_expect((x),0) +#else +#define PA_LIKELY(x) (x) +#define PA_UNLIKELY(x) (x) +#endif +#endif + #endif |