aboutsummaryrefslogtreecommitdiff
path: root/libmctp/range.h
diff options
context:
space:
mode:
Diffstat (limited to 'libmctp/range.h')
-rw-r--r--libmctp/range.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/libmctp/range.h b/libmctp/range.h
new file mode 100644
index 0000000..20349f2
--- /dev/null
+++ b/libmctp/range.h
@@ -0,0 +1,26 @@
+#ifndef _RANGE_H
+#define _RANGE_H
+
+#ifndef typeof
+#define typeof __typeof__
+#endif
+
+#ifndef MIN
+#define MIN(a, b) \
+ ({ \
+ typeof(a) _a = a; \
+ typeof(b) _b = b; \
+ _a < _b ? _a : _b; \
+ })
+#endif
+
+#ifndef MAX
+#define MAX(a, b) \
+ ({ \
+ typeof(a) _a = a; \
+ typeof(b) _b = b; \
+ _a > _b ? _a : _b; \
+ })
+#endif
+
+#endif