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 46862e9de2ede937bf69e195c3f5a949823117c7
parent 3b006c64f8aff9279a4d89551d5a2fadd2f509ee
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date:   Mon, 25 Nov 2019 06:28:20 +0000

Fix type deduction/C++17 inline variables

Diffstat:
Minclude/kfr/cometa.hpp | 36++++++++++++++++++------------------
Minclude/kfr/dsp/iir_design.hpp | 11+++--------
Mtests/expression_test.cpp | 2+-
3 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/include/kfr/cometa.hpp b/include/kfr/cometa.hpp @@ -142,49 +142,49 @@ template <typename T> using underlying_type = typename std::underlying_type<T>::type; template <typename T> -constexpr inline bool is_pod = std::is_pod_v<T> || details::is_pod_impl<T>::value; +constexpr inline bool is_pod = std::is_pod<T>::value || details::is_pod_impl<T>::value; template <typename T> -constexpr inline bool is_class = std::is_class_v<T>; +constexpr inline bool is_class = std::is_class<T>::value; template <typename T> -constexpr inline bool is_const = std::is_const_v<T>; +constexpr inline bool is_const = std::is_const<T>::value; template <typename T> -constexpr inline bool is_pointer = std::is_pointer_v<T>; +constexpr inline bool is_pointer = std::is_pointer<T>::value; template <typename T> -constexpr inline bool is_array = std::is_array_v<T>; +constexpr inline bool is_array = std::is_array<T>::value; template <typename T> -constexpr inline bool is_void = std::is_void_v<T>; +constexpr inline bool is_void = std::is_void<T>::value; template <typename T> -constexpr inline bool is_floating_point = std::is_floating_point_v<T>; +constexpr inline bool is_floating_point = std::is_floating_point<T>::value; template <typename T> -constexpr inline bool is_unsigned = std::is_unsigned_v<T>; +constexpr inline bool is_unsigned = std::is_unsigned<T>::value; template <typename T> -constexpr inline bool is_signed = std::is_signed_v<T>; +constexpr inline bool is_signed = std::is_signed<T>::value; template <typename T> -constexpr inline bool is_scalar = std::is_scalar_v<T>; +constexpr inline bool is_scalar = std::is_scalar<T>::value; template <typename T> -constexpr inline bool is_integral = std::is_integral_v<T>; +constexpr inline bool is_integral = std::is_integral<T>::value; template <typename T1, typename T2> -constexpr inline bool is_same = std::is_same_v<T1, T2>; +constexpr inline bool is_same = std::is_same<T1, T2>::value; template <typename Tbase, typename Tderived> -constexpr inline bool is_base_of = std::is_base_of_v<Tbase, Tderived>; +constexpr inline bool is_base_of = std::is_base_of<Tbase, Tderived>::value; template <typename Tfrom, typename Tto> -constexpr inline bool is_convertible = std::is_convertible_v<Tfrom, Tto>; +constexpr inline bool is_convertible = std::is_convertible<Tfrom, Tto>::value; template <typename T, typename... Args> -constexpr inline bool is_constructible = std::is_constructible_v<T, Args...>; +constexpr inline bool is_constructible = std::is_constructible<T, Args...>::value; template <typename T> constexpr inline bool is_template_arg = std::is_integral<T>::value || std::is_enum<T>::value; @@ -1625,12 +1625,12 @@ constexpr inline T choose_const_fallback(C1 c1) * CHECK( choose_const<f64>( 32.0f, 64.0 ) == 64.0 ); * @endcode */ -template <typename T, typename C1, typename... Cs, CMT_ENABLE_IF(std::is_same_v<T, C1>)> +template <typename T, typename C1, typename... Cs, CMT_ENABLE_IF(is_same<T, C1>)> constexpr inline T choose_const(C1 c1, Cs...) { return static_cast<T>(c1); } -template <typename T, typename C1, typename... Cs, CMT_ENABLE_IF(!std::is_same_v<T, C1>)> +template <typename T, typename C1, typename... Cs, CMT_ENABLE_IF(!is_same<T, C1>)> constexpr inline T choose_const(C1, Cs... constants) { return choose_const<T>(constants...); @@ -1639,7 +1639,7 @@ constexpr inline T choose_const(C1, Cs... constants) template <typename T, typename C1, typename... Cs> constexpr inline T choose_const_fallback(C1 c1, Cs... constants) { - return std::is_same_v<T, C1> ? static_cast<T>(c1) : choose_const_fallback<T>(constants...); + return is_same<T, C1> ? static_cast<T>(c1) : choose_const_fallback<T>(constants...); } template <typename Tfrom> diff --git a/include/kfr/dsp/iir_design.hpp b/include/kfr/dsp/iir_design.hpp @@ -808,7 +808,7 @@ namespace internal { template <typename T> -KFR_FUNCTION zpk<T> bilinear(const zpk<T>& filter, T fs) +KFR_FUNCTION zpk<T> bilinear(const zpk<T>& filter, identity<T> fs) { const T fs2 = 2.0 * fs; zpk<T> result; @@ -832,13 +832,8 @@ KFR_FUNCTION vec<T, 3> zpk2tf_poly(const complex<T>& x, const complex<T>& y) } template <typename T> -KFR_FUNCTION biquad_params<T> zpk2tf(const zero_pole_pairs<T>& pairs, T k) +KFR_FUNCTION biquad_params<T> zpk2tf(const zero_pole_pairs<T>& pairs, identity<T> k) { - // println("----zpk2tf"); - // println(fmt<'g', 24, 19>(pairs.z1), " | ", fmt<'g', 24, 19>(pairs.z2)); - // println(fmt<'g', 24, 19>(pairs.p1), " | ", fmt<'g', 24, 19>(pairs.p2)); - // println(k); - vec<T, 3> zz = k * zpk2tf_poly(pairs.z1, pairs.z2); vec<T, 3> pp = zpk2tf_poly(pairs.p1, pairs.p2); // return { zz[0], zz[1], zz[2], pp[0], pp[1], pp[2] }; @@ -909,7 +904,7 @@ KFR_FUNCTION int countreal(const univector<complex<T>>& list) } template <typename T> -KFR_FUNCTION zpk<T> lp2lp_zpk(const zpk<T>& filter, T wo) +KFR_FUNCTION zpk<T> lp2lp_zpk(const zpk<T>& filter, identity<T> wo) { zpk<T> result; result.z = wo * filter.z; diff --git a/tests/expression_test.cpp b/tests/expression_test.cpp @@ -18,7 +18,7 @@ namespace CMT_ARCH_NAME TEST(pack) { - static_assert(std::is_same_v<vec<f32x2, 1>, std::invoke_result_t<fn::reverse, vec<f32x2, 1>>>); + static_assert(is_same<vec<f32x2, 1>, std::invoke_result_t<fn::reverse, vec<f32x2, 1>>>); const univector<float, 21> v1 = 1 + counter(); const univector<float, 21> v2 = v1 * 11;