Skip to content

Commit 1a8d6ea

Browse files
authored
Merge pull request #3 from KernelTuner/fix_for_gcc
Fix for GCC: __has_builtin to its own preprocessor if statement
2 parents 3f622bc + 522b6b4 commit 1a8d6ea

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

include/kernel_float/macros.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,16 @@
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
53+
#if defined(__has_builtin)
54+
#if __has_builtin(__builtin_assume_aligned)
5455
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) \
5556
static_cast<TYPE*>(__builtin_assume_aligned(static_cast<TYPE*>(PTR), (ALIGNMENT)))
5657
#else
5758
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) (PTR)
5859
#endif
60+
#else
61+
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) (PTR)
62+
#endif
5963

6064
#define KERNEL_FLOAT_MAX_ALIGNMENT (32)
6165

single_include/kernel_float.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
//================================================================================
1818
// this file has been auto-generated, do not modify its contents!
19-
// date: 2023-10-24 14:14:37.228322
20-
// git hash: 28f811af866d73bef37acd541bac6a95df9a94c3
19+
// date: 2024-04-26 09:45:38.335903
20+
// git hash: 91f4860ae4ece05ec4d8e198d62d9486efa761db
2121
//================================================================================
2222

2323
#ifndef KERNEL_FLOAT_MACROS_H
@@ -72,12 +72,16 @@
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
75+
#if defined(__has_builtin)
76+
#if __has_builtin(__builtin_assume_aligned)
7677
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) \
7778
static_cast<TYPE*>(__builtin_assume_aligned(static_cast<TYPE*>(PTR), (ALIGNMENT)))
7879
#else
7980
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) (PTR)
8081
#endif
82+
#else
83+
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) (PTR)
84+
#endif
8185

8286
#define KERNEL_FLOAT_MAX_ALIGNMENT (32)
8387

0 commit comments

Comments
 (0)