range.h: Avoid duplicate definitions of MIN/MAX
Avoid duplicate definitions of MIN()/MAX() macros in environments
that already define them
Signed-off-by: Moritz Fischer <moritzf@google.com>
Change-Id: I1bdb26b54b641218821c059021dcca0062d3d0a3
diff --git a/range.h b/range.h
index 6c96015..7b1f010 100644
--- a/range.h
+++ b/range.h
@@ -1,18 +1,22 @@
#ifndef _RANGE_H
#define _RANGE_H
+#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