[lttng-dev] [PATCH 1/3] Add max() and min() macro in common

Simon Marchi simon.marchi at polymtl.ca
Tue Nov 13 13:54:54 EST 2012


Signed-off-by: Simon Marchi <simon.marchi at polymtl.ca>
---
 src/common/macros.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/common/macros.h b/src/common/macros.h
index 8185c85..81f901c 100644
--- a/src/common/macros.h
+++ b/src/common/macros.h
@@ -52,4 +52,12 @@
 #define ARRAY_SIZE(array)   (sizeof(array) / (sizeof((array)[0])))
 #endif
 
+#ifndef max
+#define max(a, b) ((a) > (b) ? (a) : (b))
+#endif
+
+#ifndef min
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
 #endif /* _MACROS_H */
-- 
1.7.1




More information about the lttng-dev mailing list