summaryrefslogtreecommitdiff
path: root/include/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/util.h')
-rw-r--r--include/util.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/util.h b/include/util.h
index c8ae09db93..fe66936cf4 100644
--- a/include/util.h
+++ b/include/util.h
@@ -16,13 +16,15 @@
#include <stddef.h>
/* Standard macros / definitions */
+#define GENERIC_MAX(x, y) ((x) > (y) ? (x) : (y))
+#define GENERIC_MIN(x, y) ((x) < (y) ? (x) : (y))
#ifndef MAX
#define MAX(a, b) \
({ \
__typeof__(a) temp_a = (a); \
__typeof__(b) temp_b = (b); \
\
- temp_a > temp_b ? temp_a : temp_b; \
+ GENERIC_MAX(temp_a, temp_b); \
})
#endif
#ifndef MIN
@@ -31,7 +33,7 @@
__typeof__(a) temp_a = (a); \
__typeof__(b) temp_b = (b); \
\
- temp_a < temp_b ? temp_a : temp_b; \
+ GENERIC_MIN(temp_a, temp_b); \
})
#endif
#ifndef NULL