summaryrefslogtreecommitdiffstats
path: root/src/kernel/tests/include/tst_minmax.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/tests/include/tst_minmax.h')
-rw-r--r--src/kernel/tests/include/tst_minmax.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/kernel/tests/include/tst_minmax.h b/src/kernel/tests/include/tst_minmax.h
new file mode 100644
index 0000000..6417dd7
--- /dev/null
+++ b/src/kernel/tests/include/tst_minmax.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+#ifndef TST_MINMAX_H__
+#define TST_MINMAX_H__
+
+#ifndef MIN
+# define MIN(a, b) ({ \
+ typeof(a) _a = (a); \
+ typeof(b) _b = (b); \
+ _a < _b ? _a : _b; \
+})
+#endif /* MIN */
+
+#ifndef MAX
+# define MAX(a, b) ({ \
+ typeof(a) _a = (a); \
+ typeof(b) _b = (b); \
+ _a > _b ? _a : _b; \
+})
+#endif /* MAX */
+
+#endif /* TST_MINMAX_H__ */