summaryrefslogtreecommitdiff
path: root/src/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index e679bf9..4d7acf6 100644
--- a/src/common.h
+++ b/src/common.h
@@ -42,3 +42,8 @@ typedef double f64;
#define stz_xstr(a) str(a)
#define stz_str(a) #a
+
+// Get a T from (x, y) in an x*y flat T* array
+#define ARR2(array, x, w, y) ((array)[(u64)(x) + ((u64)(y)*(u64)(w))])
+// Get a T* from (x, y) in an x*y flat T* array
+#define ARR2_PTR(array, x, w, y) (&(array)[(u64)(x) + ((u64)(y)*(u64)(w))])