diff --git a/include/cglm/types.h b/include/cglm/types.h index bafebe6..65391cd 100644 --- a/include/cglm/types.h +++ b/include/cglm/types.h @@ -8,6 +8,10 @@ #ifndef cglm_types_h #define cglm_types_h +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) +# include +#endif + #if defined(_MSC_VER) /* do not use alignment for older visual studio versions */ # if _MSC_VER < 1913 /* Visual Studio 2017 version 15.6 */ @@ -57,8 +61,16 @@ # define CGLM_ASSUME_ALIGNED(expr, alignment) (expr) #endif -#define CGLM_CASTPTR_ASSUME_ALIGNED(expr, type) \ - ((type*)CGLM_ASSUME_ALIGNED((expr), __alignof__(type))) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) +# define CGLM_CASTPTR_ASSUME_ALIGNED(expr, type) \ + ((type*)CGLM_ASSUME_ALIGNED((expr), alignof(type))) +#elif defined(_MSC_VER) +# define CGLM_CASTPTR_ASSUME_ALIGNED(expr, type) \ + ((type*)CGLM_ASSUME_ALIGNED((expr), __alignof(type))) +#else +# define CGLM_CASTPTR_ASSUME_ALIGNED(expr, type) \ + ((type*)CGLM_ASSUME_ALIGNED((expr), __alignof__(type))) +#endif typedef int ivec2[2]; typedef int ivec3[3];