summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/minmax.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/minmax.h b/include/linux/minmax.h
index ca69abd6151e..2a197f54fe05 100644
--- a/include/linux/minmax.h
+++ b/include/linux/minmax.h
@@ -77,6 +77,23 @@
#define max(x, y) __careful_cmp(x, y, >)
/**
+ * umin - return minimum of two non-negative values
+ * Signed types are zero extended to match a larger unsigned type.
+ * @x: first value
+ * @y: second value
+ */
+#define umin(x, y) \
+ __careful_cmp((x) + 0u + 0ul + 0ull, (y) + 0u + 0ul + 0ull, <)
+
+/**
+ * umax - return maximum of two non-negative values
+ * @x: first value
+ * @y: second value
+ */
+#define umax(x, y) \
+ __careful_cmp((x) + 0u + 0ul + 0ull, (y) + 0u + 0ul + 0ull, >)
+
+/**
* min3 - return minimum of three values
* @x: first value
* @y: second value