mirror of
https://github.com/recp/cglm.git
synced 2026-02-17 03:39:05 +00:00
simd/x86: fix -Wcast-align warnings (gcc/clang)
This modifies glmm_{load,store}3 functions to make the compiler assume
the v pointer is appropriately aligned for the type it is being cast to.
Not tested with CGLM_ALL_UNALIGNED, but it probably doesn't matter.
This commit is contained in:
@@ -32,6 +32,16 @@
|
||||
# define CGLM_ALIGN_MAT CGLM_ALIGN(16)
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define CGLM_ASSUME_ALIGNED(expr, alignment) \
|
||||
__builtin_assume_aligned((expr), (alignment))
|
||||
#else
|
||||
# define CGLM_ASSUME_ALIGNED(expr, alignment) (expr)
|
||||
#endif
|
||||
|
||||
#define CGLM_CASTPTR_ASSUME_ALIGNED(expr, type) \
|
||||
((type*)CGLM_ASSUME_ALIGNED((expr), __alignof__(type)))
|
||||
|
||||
typedef float vec2[2];
|
||||
typedef float vec3[3];
|
||||
typedef int ivec3[3];
|
||||
|
||||
Reference in New Issue
Block a user