A few min/max cleanups
[fio.git] / minmax.h
index 97957c8874e2e68b6e84a318d70c7c62670501bf..afc78f02e4b3f4cfe2de624d780301a54f8bc926 100644 (file)
--- a/minmax.h
+++ b/minmax.h
@@ -17,4 +17,9 @@
        _x > _y ? _x : _y; })
 #endif
 
+#define min_not_zero(x, y) ({          \
+       typeof(x) __x = (x);            \
+       typeof(y) __y = (y);            \
+       __x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); })
+
 #endif