Skip to content

Commit

Permalink
Merge pull request #279 from NeRdTheNed/master
Browse files Browse the repository at this point in the history
Check for builtin before using it
  • Loading branch information
recp authored Mar 7, 2023
2 parents bc8dc72 + f4c9ddf commit 799749f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions include/cglm/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@
# define CGLM_ALIGN_MAT CGLM_ALIGN(16)
#endif

#ifdef __GNUC__
# define CGLM_ASSUME_ALIGNED(expr, alignment) \
__builtin_assume_aligned((expr), (alignment))
#if defined(__has_builtin)
# if __has_builtin(__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
Expand Down

0 comments on commit 799749f

Please sign in to comment.