[CRIU] [PATCH 1/2] compiler: Grab min_t, max_t from the kernel

Cyrill Gorcunov gorcunov at openvz.org
Thu Nov 12 03:44:34 PST 2015


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 include/compiler.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/compiler.h b/include/compiler.h
index 3f3e6d6ba9be..894393e9d474 100644
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -66,6 +66,16 @@
 	(void) (&_max1 == &_max2);		\
 	_max1 > _max2 ? _max1 : _max2; })
 
+#define min_t(type, x, y) ({			\
+	type __min1 = (x);			\
+	type __min2 = (y);			\
+	__min1 < __min2 ? __min1: __min2; })
+
+#define max_t(type, x, y) ({			\
+	type __max1 = (x);			\
+	type __max2 = (y);			\
+	__max1 > __max2 ? __max1: __max2; })
+
 #define is_log2(v)		(((v) & ((v) - 1)) == 0)
 
 #endif /* __CR_COMPILER_H__ */
-- 
2.4.3



More information about the CRIU mailing list