From 11cb1d1bfb6bd7e306a4bff35fe82bb937a752e0 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Mon, 8 Aug 2022 19:14:55 -0300 Subject: macros: Add `min()`, and `max()` macros These macros help with finding the minimum, and maximum of two values. --- macros.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'macros.h') 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 -- cgit v1.2.3-13-gbd6f