[PATCH v2 09/10] useful: Add maxsize()
Denis Kenzior <[email protected]>
| Newsgroups | dev.linux.lists.ell |
|---|---|
| Message-ID | <[email protected]> |
Similar to minsize(), but for finding the maximum of two sizes
---
ell/useful.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/ell/useful.h b/ell/useful.h
index 791fa2006494..efd91d78b3f2 100644
--- a/ell/useful.h
+++ b/ell/useful.h
@@ -38,6 +38,14 @@ static inline size_t minsize(size_t a, size_t b)
return b;
}
+static inline size_t maxsize(size_t a, size_t b)
+{
+ if (a >= b)
+ return a;
+
+ return b;
+}
+
static inline void set_bit(void *addr, unsigned int bit)
{
unsigned char *field = addr;
--
2.35.1