aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2022-07-11 15:40:11 -0500
committerDenis Kenzior <denkenz@gmail.com>2022-07-26 20:44:00 -0500
commit1ff33745276002b871c50c82be8a44f98e5f36bd (patch)
treef9b26adbd7aef64706104c278afb4a4ef76ec2f5
parentf8f2d442da56500987f230bfed1b9f420cfd3428 (diff)
useful: Add maxsize()
Similar to minsize(), but for finding the maximum of two sizes
-rw-r--r--ell/useful.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/ell/useful.h b/ell/useful.h
index 791fa200..efd91d78 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;