From 30822162d1bd5995160064389cfec1e6414f4bfa Mon Sep 17 00:00:00 2001 From: steven-na Date: Wed, 14 Oct 2026 17:35:02 -0700 Subject: 2d array stuff --- src/common.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/common.h') 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))]) -- cgit v1.2.3