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 0769b690fd087224f4e527dc31007eaafa5401f3
parent cddc7e632f2dde1c6b76fa0b7525761d35f19ca9
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date:   Tue,  4 Apr 2017 02:40:26 +0300

Fixes for Visual Studio

Diffstat:
Minclude/kfr/base/vec.hpp | 8++++----
Minclude/kfr/io/python_plot.hpp | 7++++++-
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/include/kfr/base/vec.hpp b/include/kfr/base/vec.hpp @@ -239,21 +239,21 @@ struct vec<vec<T, Nin>, N> : private vec<T, Nin * N> CMT_GNU_CONSTEXPR value_type operator[](size_t index) const noexcept { return get(index); } CMT_GNU_CONSTEXPR element operator[](size_t index) noexcept { return { *this, index }; } - constexpr value_type get(size_t index) const noexcept + CMT_GNU_CONSTEXPR value_type get(size_t index) const noexcept { return reinterpret_cast<const value_type(&)[N]>(*this)[index]; } - constexpr void set(size_t index, const value_type& s) noexcept + CMT_GNU_CONSTEXPR void set(size_t index, const value_type& s) noexcept { reinterpret_cast<value_type(&)[N]>(*this)[index] = s; } template <size_t index> - constexpr value_type get(csize_t<index>) const noexcept + CMT_GNU_CONSTEXPR value_type get(csize_t<index>) const noexcept { return static_cast<const base&>(*this).shuffle(csizeseq_t<Nin, index * Nin>()); } template <size_t index> - constexpr void set(csize_t<index>, const value_type& s) noexcept + CMT_GNU_CONSTEXPR void set(csize_t<index>, const value_type& s) noexcept { *this = vec(static_cast<const base&>(*this)) .shuffle(s, csizeseq_t<N>() + diff --git a/include/kfr/io/python_plot.hpp b/include/kfr/io/python_plot.hpp @@ -68,11 +68,16 @@ void python(const std::string& name, const std::string& code) } CMT_PRAGMA_GNU(GCC diagnostic pop) -template <typename T> +template <typename T, KFR_ENABLE_IF(std::is_floating_point<T>::value)> inline T flush_to_zero(T value) { return std::isfinite(value) ? value : 0; } +template <typename T, KFR_ENABLE_IF(!std::is_floating_point<T>::value)> +inline T flush_to_zero(T value) +{ + return static_cast<double>(value); +} } inline std::string concat_args() { return {}; }