diff options
| author | steven-na <noreply.github@stvnc.dev> | 2026-10-14 17:35:02 -0700 |
|---|---|---|
| committer | steven-na <noreply.github@stvnc.dev> | 2026-10-14 17:35:02 -0700 |
| commit | 30822162d1bd5995160064389cfec1e6414f4bfa (patch) | |
| tree | befb301e6c9cb3490c5a8b8b7abaaf87835b96a3 /src/common.h | |
| parent | 63e984474000b7dfed617818087bb7c755f208a0 (diff) | |
2d array stuffmain
Diffstat (limited to 'src/common.h')
| -rw-r--r-- | src/common.h | 5 |
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))]) |