# HG changeset patch # User Paper # Date 1754769760 14400 # Node ID d26d22c602bd878ea520c8e6e13037b6265817c7 # Parent 31cee67540b5241cbd9ddf2684cc40ddf6aaea86 vec: fix VEC_ALIGNED_ARRAY implementation for bad compilers diff -r 31cee67540b5 -r d26d22c602bd include/vec/vec.h --- a/include/vec/vec.h Sat Aug 09 15:55:59 2025 -0400 +++ b/include/vec/vec.h Sat Aug 09 16:02:40 2025 -0400 @@ -448,10 +448,10 @@ # define VEC_ALIGNED_ARRAY_SIZEOF(var, align) \ (sizeof(var)) #else -// use unions to get an aligned offset without triggering strict aliasing +/* emulate it for compilers that suck */ # define VEC_ALIGNED_ARRAY(type, var, length, align) \ type vec_unaligned_##var##_[length + (align) - 1]; \ - type *var = ((union vec_aligned_union_##var##_ *)(((vec_uintptr)vec_unaligned_##var##_ + (align - 1)) & ~(align - 1)))->arr; + type *var = (type *)(((vec_uintptr)vec_unaligned_##var##_ + (align - 1)) & ~(align - 1)); # define VEC_ALIGNED_ARRAY_SIZEOF(var, align) \ (sizeof(vec_unaligned_##var##_) - (align - 1)) #endif