summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-09-21 00:14:20 +0000
committerLennart Poettering <lennart@poettering.net>2007-09-21 00:14:20 +0000
commit29d25ec8d99a362030b9c4bd4ad3f9c4ad6f95c7 (patch)
treed6ca58307810acba827ceb6f23dbbc7a2eafe30b
parente205bb2555d8c723d0343e97c87c3d82e063c7ff (diff)
add CLAMP macro
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1876 fefdeb5f-60dc-0310-8127-8f9354f1896f
-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 d0dff5e1..c6bba437 100644
--- a/src/pulsecore/macro.h
+++ b/src/pulsecore/macro.h
@@ -28,7 +28,7 @@
#include <unistd.h>
#include <assert.h>
#include <limits.h>
-#include <unistd.h>
+#include <unistd.h>
#include <pulsecore/log.h>
@@ -72,6 +72,10 @@ static inline size_t pa_page_align(size_t l) {
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
+#ifndef CLAMP
+#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
+#endif
+
/* This type is not intended to be used in exported APIs! Use classic "int" there! */
#ifdef HAVE_STD_BOOL
typedef _Bool pa_bool_t;