Skip to content

Commit 91f4860

Browse files
__has_builtin to its own if, see issue #2
1 parent 3f622bc commit 91f4860

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

include/kernel_float/macros.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@
5050
#define KERNEL_FLOAT_CALL(F, ...) F(__VA_ARGS__)
5151

5252
// TOOD: check if this way is support across all compilers
53-
#if defined(__has_builtin) && __has_builtin(__builtin_assume_aligned) && 0
54-
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) \
55-
static_cast<TYPE*>(__builtin_assume_aligned(static_cast<TYPE*>(PTR), (ALIGNMENT)))
53+
#if defined(__has_builtin)
54+
#if __has_builtin(__builtin_assume_aligned) && 0
55+
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) \
56+
static_cast<TYPE*>(__builtin_assume_aligned(static_cast<TYPE*>(PTR), (ALIGNMENT)))
57+
#endif
5658
#else
5759
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) (PTR)
5860
#endif

single_include/kernel_float.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@
7272
#define KERNEL_FLOAT_CALL(F, ...) F(__VA_ARGS__)
7373

7474
// TOOD: check if this way is support across all compilers
75-
#if defined(__has_builtin) && __has_builtin(__builtin_assume_aligned) && 0
76-
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) \
77-
static_cast<TYPE*>(__builtin_assume_aligned(static_cast<TYPE*>(PTR), (ALIGNMENT)))
75+
#if defined(__has_builtin)
76+
#if __has_builtin(__builtin_assume_aligned) && 0
77+
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) \
78+
static_cast<TYPE*>(__builtin_assume_aligned(static_cast<TYPE*>(PTR), (ALIGNMENT)))
79+
#endif
7880
#else
7981
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) (PTR)
8082
#endif

0 commit comments

Comments
 (0)