[Piglit] [PATCH v2 1/5] util: add MIN3/MAX3 convenience macros

Nicolai Hähnle nhaehnle at gmail.com
Wed Apr 19 07:36:09 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 tests/util/piglit-util.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 7e9c840..b30ae07 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -176,20 +176,22 @@ enum piglit_result
 piglit_run_selected_subtests(const struct piglit_subtest *all_subtests,
 			     const char **selected_subtests,
 			     size_t num_selected_subtests,
 			     enum piglit_result previous_result);
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
 
 #define CLAMP( X, MIN, MAX )  ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
 #define MIN2(a, b) ((a) > (b) ? (b) : (a))
 #define MAX2(a, b) ((a) > (b) ? (a) : (b))
+#define MIN3(a, b, c) MIN2(MIN2((a), (b)), (c))
+#define MAX3(a, b, c) MAX2(MAX2((a), (b)), (c))
 #define ALIGN(value, alignment) (((value) + alignment - 1) & ~(alignment - 1))
 
 /**
  * Utility macro that checks for a given opengl error, and report a
  * subtest result.
  */
 #define PIGLIT_SUBTEST_ERROR(error, global, ...) \
 do { \
 	bool local = piglit_check_gl_error((error)); \
 	global = global && local; \
-- 
2.9.3



More information about the Piglit mailing list