kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
Log | Files | Refs | README

commit 9d52ae08e824015a89118025ce74d69577b65429
parent 1ffcbf78db5168ec7f05fdf75663ee6052d826c4
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date:   Thu, 10 Nov 2022 18:10:07 +0000

Disable forced inlining for NDEBUG builds

Diffstat:
Minclude/kfr/cident.h | 20++++++++++++++++----
Minclude/kfr/cometa/string.hpp | 8++++----
2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/include/kfr/cident.h b/include/kfr/cident.h @@ -360,8 +360,14 @@ extern char* gets(char* __s); #define CMT_ALWAYS_INLINE #endif -#define CMT_INLINE __inline__ CMT_ALWAYS_INLINE -#define CMT_INLINE_MEMBER CMT_ALWAYS_INLINE +#ifdef NDEBUG +#define CMT_INLINE_IN_RELEASE CMT_ALWAYS_INLINE +#else +#define CMT_INLINE_IN_RELEASE +#endif + +#define CMT_INLINE __inline__ CMT_INLINE_IN_RELEASE +#define CMT_INLINE_MEMBER CMT_INLINE_IN_RELEASE #if defined(CMT_COMPILER_GCC) && \ (CMT_GCC_VERSION >= 900 && CMT_GCC_VERSION < 904 || CMT_GCC_VERSION >= 1000 && CMT_GCC_VERSION < 1002) // Workaround for GCC 9/10 bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90333 @@ -392,9 +398,15 @@ extern char* gets(char* __s); #define CMT_ALWAYS_INLINE #endif +#ifdef NDEBUG +#define CMT_INLINE_IN_RELEASE CMT_ALWAYS_INLINE +#else +#define CMT_INLINE_IN_RELEASE +#endif + #define CMT_NODEBUG -#define CMT_INLINE inline CMT_ALWAYS_INLINE -#define CMT_INLINE_MEMBER CMT_ALWAYS_INLINE +#define CMT_INLINE inline CMT_INLINE_IN_RELEASE +#define CMT_INLINE_MEMBER CMT_INLINE_IN_RELEASE #if _MSC_VER >= 1927 #define CMT_INLINE_LAMBDA [[msvc::forceinline]] #else diff --git a/include/kfr/cometa/string.hpp b/include/kfr/cometa/string.hpp @@ -538,7 +538,7 @@ namespace details { template <size_t dims> -CMT_ALWAYS_INLINE size_t trailing_zeros(const std::array<size_t, dims>& indices) +CMT_INTRINSIC size_t trailing_zeros(const std::array<size_t, dims>& indices) { for (size_t i = 0; i < dims; ++i) { @@ -549,7 +549,7 @@ CMT_ALWAYS_INLINE size_t trailing_zeros(const std::array<size_t, dims>& indices) } template <size_t dims> -CMT_ALWAYS_INLINE bool increment_indices(std::array<size_t, dims>& indices, +CMT_INTRINSIC bool increment_indices(std::array<size_t, dims>& indices, const std::array<size_t, dims>& stop) { indices[dims - 1] += 1; @@ -572,12 +572,12 @@ CMT_ALWAYS_INLINE bool increment_indices(std::array<size_t, dims>& indices, } // namespace details template <typename U, typename Fmt> -CMT_ALWAYS_INLINE Fmt wrap_fmt(const U& val, ctype_t<Fmt>) +CMT_INTRINSIC Fmt wrap_fmt(const U& val, ctype_t<Fmt>) { return Fmt{ val }; } template <typename U> -CMT_ALWAYS_INLINE U wrap_fmt(const U& val, ctype_t<void>) +CMT_INTRINSIC U wrap_fmt(const U& val, ctype_t<void>) { return val; }