mirror of
https://github.com/recp/cglm.git
synced 2025-10-03 16:51:35 +00:00
Use the appropriate version of alignof
This commit is contained in:
@@ -8,6 +8,10 @@
|
|||||||
#ifndef cglm_types_h
|
#ifndef cglm_types_h
|
||||||
#define cglm_types_h
|
#define cglm_types_h
|
||||||
|
|
||||||
|
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
|
||||||
|
# include <stdalign.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
/* do not use alignment for older visual studio versions */
|
/* do not use alignment for older visual studio versions */
|
||||||
# if _MSC_VER < 1913 /* Visual Studio 2017 version 15.6 */
|
# if _MSC_VER < 1913 /* Visual Studio 2017 version 15.6 */
|
||||||
@@ -57,8 +61,16 @@
|
|||||||
# define CGLM_ASSUME_ALIGNED(expr, alignment) (expr)
|
# define CGLM_ASSUME_ALIGNED(expr, alignment) (expr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CGLM_CASTPTR_ASSUME_ALIGNED(expr, type) \
|
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
|
||||||
((type*)CGLM_ASSUME_ALIGNED((expr), __alignof__(type)))
|
# 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 ivec2[2];
|
||||||
typedef int ivec3[3];
|
typedef int ivec3[3];
|
||||||
|
Reference in New Issue
Block a user