Skip to content

Commit

Permalink
Fix missing else case for if __has_builtin(__builtin_assume_aligned)
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnh committed Apr 26, 2024
1 parent 91f4860 commit 522b6b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
10 changes: 6 additions & 4 deletions include/kernel_float/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@

// TOOD: check if this way is support across all compilers
#if defined(__has_builtin)
#if __has_builtin(__builtin_assume_aligned) && 0
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) \
static_cast<TYPE*>(__builtin_assume_aligned(static_cast<TYPE*>(PTR), (ALIGNMENT)))
#endif
#if __has_builtin(__builtin_assume_aligned)
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) \
static_cast<TYPE*>(__builtin_assume_aligned(static_cast<TYPE*>(PTR), (ALIGNMENT)))
#else
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) (PTR)
#endif
#else
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) (PTR)
#endif
Expand Down
14 changes: 8 additions & 6 deletions single_include/kernel_float.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

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

#ifndef KERNEL_FLOAT_MACROS_H
Expand Down Expand Up @@ -73,10 +73,12 @@

// TOOD: check if this way is support across all compilers
#if defined(__has_builtin)
#if __has_builtin(__builtin_assume_aligned) && 0
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) \
static_cast<TYPE*>(__builtin_assume_aligned(static_cast<TYPE*>(PTR), (ALIGNMENT)))
#endif
#if __has_builtin(__builtin_assume_aligned)
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) \
static_cast<TYPE*>(__builtin_assume_aligned(static_cast<TYPE*>(PTR), (ALIGNMENT)))
#else
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) (PTR)
#endif
#else
#define KERNEL_FLOAT_ASSUME_ALIGNED(TYPE, PTR, ALIGNMENT) (PTR)
#endif
Expand Down

0 comments on commit 522b6b4

Please sign in to comment.