Skip to content
Snippets Groups Projects
Commit fc2ce286 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Only use the alignment built-in functions if they exist (i.e. GCC > 4.6)

parent 93c17570
No related branches found
No related tags found
No related merge requests found
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
* alignment. * alignment.
* *
* Note that this turns into a no-op but gives information to the compiler. * Note that this turns into a no-op but gives information to the compiler.
* For GCC versions older than 4.6 this is ignored as the builtin does not
* exist.
* *
* @param type The type of the array. * @param type The type of the array.
* @param array The array. * @param array The array.
...@@ -52,11 +54,11 @@ ...@@ -52,11 +54,11 @@
#if defined(__ICC) #if defined(__ICC)
#define swift_align_information(type, array, alignment) \ #define swift_align_information(type, array, alignment) \
__assume_aligned(array, alignment); __assume_aligned(array, alignment);
#elif defined(__GNUC__) #elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ > 6)
#define swift_align_information(type, array, alignment) \ #define swift_align_information(type, array, alignment) \
array = (type *)__builtin_assume_aligned(array, alignment); array = (type *)__builtin_assume_aligned(array, alignment);
#else #else
#define swift_align_information(array, alignment) ; #define swift_align_information(type, array, alignment) ;
#endif #endif
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment