summaryrefslogtreecommitdiffstats
path: root/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'util.h')
-rw-r--r--util.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..b34da36
--- /dev/null
+++ b/util.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#include <stdio.h>
+
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define MIN(a, b) ((a) > (b) ? (b) : (a))
+#define ARRLEN(x) (sizeof(x)/sizeof((x)[0]))
+
+#define ASSERT(x) assert((x), __FILE__, __LINE__, #x)
+
+int strnwidth(const char *s, int n);
+void assert(int cond, const char *file, int line, const char *condstr);