summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2022-08-08 19:14:55 -0300
committermrb0nk500 <b0nk@b0nk.xyz>2022-08-08 19:14:55 -0300
commit11cb1d1bfb6bd7e306a4bff35fe82bb937a752e0 (patch)
tree6b93d8988bf140c16bb48829419dfd92d7598600
parentc8a1f90c7a329b2e2a3c6622f9bddaea9ac56dda (diff)
macros: Add `min()`, and `max()` macros
These macros help with finding the minimum, and maximum of two values.
-rw-r--r--macros.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/macros.h b/macros.h
index 2be1d6b..14e7da0 100644
--- a/macros.h
+++ b/macros.h
@@ -1,6 +1,9 @@
#ifndef MACROS_H
#define MACROS_H
+#define min(a, b) (((a) < (b)) ? (a) : (b))
+#define max(a, b) (((a) > (b)) ? (a) : (b))
+
#define const_strlen(str) sizeof((char []){str})
#ifndef LOG_H