mirror of
https://github.com/recp/cglm.git
synced 2025-10-03 16:51:35 +00:00
Merge branch 'master' into non-square-matrix
This commit is contained in:
@@ -32,16 +32,30 @@
|
||||
# define CGLM_ALIGN_MAT CGLM_ALIGN(16)
|
||||
#endif
|
||||
|
||||
#ifndef CGLM_HAVE_BUILTIN_ASSUME_ALIGNED
|
||||
|
||||
# if defined(__has_builtin)
|
||||
# if __has_builtin(__builtin_assume_aligned)
|
||||
# define CGLM_HAVE_BUILTIN_ASSUME_ALIGNED 1
|
||||
# endif
|
||||
# elif defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||
# if __GNUC__ >= 4 && __GNUC_MINOR__ >= 7
|
||||
# define CGLM_HAVE_BUILTIN_ASSUME_ALIGNED 1
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef CGLM_HAVE_BUILTIN_ASSUME_ALIGNED
|
||||
# define CGLM_HAVE_BUILTIN_ASSUME_ALIGNED 0
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#if CGLM_HAVE_BUILTIN_ASSUME_ALIGNED
|
||||
# define CGLM_ASSUME_ALIGNED(expr, alignment) \
|
||||
__builtin_assume_aligned((expr), (alignment))
|
||||
#else
|
||||
# define CGLM_ASSUME_ALIGNED(expr, alignment) (expr)
|
||||
#endif
|
||||
#else
|
||||
# define CGLM_ASSUME_ALIGNED(expr, alignment) (expr)
|
||||
#endif
|
||||
|
||||
#define CGLM_CASTPTR_ASSUME_ALIGNED(expr, type) \
|
||||
((type*)CGLM_ASSUME_ALIGNED((expr), __alignof__(type)))
|
||||
|
12
meson.build
12
meson.build
@@ -17,11 +17,19 @@ cglm_args = []
|
||||
build_args = []
|
||||
|
||||
if get_option('default_library') == 'static'
|
||||
cglm_args = '-DCGLM_STATIC'
|
||||
cglm_args += '-DCGLM_STATIC'
|
||||
endif
|
||||
|
||||
if cc.compiles(
|
||||
'int *test(char *p) { return (int*)__builtin_assume_aligned(p, 4); }',
|
||||
name : '__builtin_assume_aligned test')
|
||||
cglm_args += '-DCGLM_HAVE_BUILTIN_ASSUME_ALIGNED=1'
|
||||
else
|
||||
cglm_args += '-DCGLM_HAVE_BUILTIN_ASSUME_ALIGNED=0'
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
build_args = '-DCGLM_EXPORTS'
|
||||
build_args += '-DCGLM_EXPORTS'
|
||||
endif
|
||||
|
||||
cglm_inc = include_directories('include')
|
||||
|
Reference in New Issue
Block a user