summaryrefslogtreecommitdiff
path: root/src/pulsecore/macro.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-11-09 01:29:50 +0000
committerLennart Poettering <lennart@poettering.net>2007-11-09 01:29:50 +0000
commitcb66762d6dea8ac8871bb23efbf8c9b77f8d08fd (patch)
tree5c47a64f93a70cbdb2a25da34c85bc809302e7e0 /src/pulsecore/macro.h
parentc8cdb06135e2e316a724098e5c0af7aa9e81091e (diff)
add PA_CLAMP_LIKELY and PA_CLAMP_UNLIKELY macros
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2033 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulsecore/macro.h')
-rw-r--r--src/pulsecore/macro.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pulsecore/macro.h b/src/pulsecore/macro.h
index c6bba437..548e4ed9 100644
--- a/src/pulsecore/macro.h
+++ b/src/pulsecore/macro.h
@@ -31,6 +31,7 @@
#include <unistd.h>
#include <pulsecore/log.h>
+#include <pulsecore/gccmacro.h>
#ifndef PACKAGE
#error "Please include config.h before including this file!"
@@ -73,9 +74,12 @@ static inline size_t pa_page_align(size_t l) {
#endif
#ifndef CLAMP
-#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
+#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
#endif
+#define PA_CLAMP_LIKELY(x, low, high) (PA_LIKELY((x) > (high)) ? (high) : PA_LIKELY(((x) < (low)) ? (low) : (x)))
+#define PA_CLAMP_UNLIKELY(x, low, high) (PA_UNLIKELY((x) > (high)) ? (high) : PA_UNLIKELY(((x) < (low)) ? (low) : (x)))
+
/* This type is not intended to be used in exported APIs! Use classic "int" there! */
#ifdef HAVE_STD_BOOL
typedef _Bool pa_bool_t;