From 2366e3b85a565af0732d7c6e4308317efa04f89a Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Sat, 17 Sep 2016 12:54:24 +0300 Subject: [PATCH] align vec4/mat4 to 16 in typedef --- include/cglm-common.h | 2 ++ include/cglm.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/cglm-common.h b/include/cglm-common.h index abcf5da..3ba492f 100644 --- a/include/cglm-common.h +++ b/include/cglm-common.h @@ -12,8 +12,10 @@ #if defined(_WIN32) # define CGLM_INLINE __forceinline +# define CGLM_ALIGN(X) __declspec(align(X)) #else # define CGLM_INLINE static inline __attribute((always_inline)) +# define CGLM_ALIGN(X) __attribute((aligned(X))) #endif #define glm__memcpy(type, dest, src, size) \ diff --git a/include/cglm.h b/include/cglm.h index a7ddf41..f66c4ff 100644 --- a/include/cglm.h +++ b/include/cglm.h @@ -11,7 +11,7 @@ #include "cglm-common.h" typedef float vec3[3]; -typedef float vec4[4]; +typedef CGLM_ALIGN(16) float vec4[4]; typedef vec3 mat3[3]; typedef vec4 mat4[4];