summaryrefslogtreecommitdiff
path: root/src/common.h
diff options
context:
space:
mode:
authorsteven-na <noreply.github@stvnc.dev>2026-10-14 17:35:02 -0700
committersteven-na <noreply.github@stvnc.dev>2026-10-14 17:35:02 -0700
commit30822162d1bd5995160064389cfec1e6414f4bfa (patch)
treebefb301e6c9cb3490c5a8b8b7abaaf87835b96a3 /src/common.h
parent63e984474000b7dfed617818087bb7c755f208a0 (diff)
2d array stuffmain
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))])