aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cup/utils.c5
-rw-r--r--cup/utils.h3
2 files changed, 7 insertions, 1 deletions
diff --git a/cup/utils.c b/cup/utils.c
index 79d849e..2335981 100644
--- a/cup/utils.c
+++ b/cup/utils.c
@@ -24,4 +24,7 @@ void _die_location(char *file, int line, Location loc, const char *fmt, ...)
fprintf(stderr, "\n");
fprintf(stderr, "NOTE: Error occurred in %s:%d\n", file, line);
exit(1);
-} \ No newline at end of file
+}
+
+i64 i64max(i64 a, i64 b) { return a > b ? a : b; }
+i64 i64min(i64 a, i64 b) { return a < b ? a : b; } \ No newline at end of file
diff --git a/cup/utils.h b/cup/utils.h
index ae81f8d..dfc018c 100644
--- a/cup/utils.h
+++ b/cup/utils.h
@@ -6,4 +6,7 @@
void die(const char *fmt, ...);
void _die_location(char *file, int line, Location loc, const char *fmt, ...);
+i64 i64max(i64 a, i64 b);
+i64 i64min(i64 a, i64 b);
+
#define die_location(loc, ...) _die_location(__FILE__, __LINE__, loc, __VA_ARGS__) \ No newline at end of file