From 24dd5250f83e3b23193c6fa44fd8629461eada36 Mon Sep 17 00:00:00 2001 From: Ivar Fatland Date: Thu, 26 Feb 2026 20:26:05 +0100 Subject: [PATCH] make it compile on zig compier cannot access null field members, also cannot access field that is misaligned. pretend there is something at high multiple of 2 value to future proof to stupid degree and stop the zig compiler from complaining about the cool hack --- cig.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cig.h b/cig.h index 4b12ed7..ea372a1 100644 --- a/cig.h +++ b/cig.h @@ -9,7 +9,7 @@ #include typedef union any_align { char c; int i; long l; long long ll; float f; double d; void *p; long double ld; } any_align_t; -#define ALIGN_OF(TYPE) ((size_t)(&((struct{char c; TYPE t;}*) 0)->t)) +#define ALIGN_OF(TYPE) ((size_t)(&((struct{char c; TYPE t;}*) 256)->t) - 256) #define MAX_ALIGN (ALIGN_OF(any_align_t)) #define KB (1024) #define MB (KB * KB)