Skip to content

Commit

Permalink
AMREX_FLATTEN (AMReX-Codes#3840)
Browse files Browse the repository at this point in the history
This could be used to force inline calls in a function.
  • Loading branch information
WeiqunZhang authored Mar 25, 2024
1 parent a863358 commit d7d7091
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Src/Base/AMReX_Extension.H
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@
#elif defined(__GNUC__)
#define AMREX_FORCE_INLINE inline __attribute__((always_inline))

#elif defined(_MSC_VER)
#define AMREX_FORCE_INLINE inline __forceinline

#else
#define AMREX_FORCE_INLINE inline

Expand All @@ -133,6 +136,15 @@
#define AMREX_NO_INLINE
#endif

// flatten
#if defined(_MSC_VER)
#define AMREX_FLATTEN [[msvc::flatten]]
#elif defined(__clang__) || defined(__GNUC__)
#define AMREX_FLATTEN __attribute__((flatten))
#else
#define AMREX_FLATTEN
#endif

// unroll loop
#define AMREX_TO_STRING_HELPER(X) #X
#define AMREX_TO_STRING(X) AMREX_TO_STRING_HELPER(X)
Expand Down

0 comments on commit d7d7091

Please sign in to comment.