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 4278e4d4477ba28f274ebae038ea5fd02f190200
parent e875215e8d3baea5beff2495b99e6b29f14b07f7
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date:   Mon, 25 Jul 2016 13:42:37 +0300

Add operators to kfr::complex

Diffstat:
Minclude/kfr/base/complex.hpp | 21+++++++++++++++++++++
1 file changed, 21 insertions(+), 0 deletions(-)

diff --git a/include/kfr/base/complex.hpp b/include/kfr/base/complex.hpp @@ -78,6 +78,27 @@ struct complex constexpr void imag(T value) noexcept { im = value; } T re; T im; + + KFR_INTRIN friend complex operator+(const complex& x, const complex& y) + { + return (make_vector(x) + make_vector(y))[0]; + } + KFR_INTRIN friend complex operator-(const complex& x, const complex& y) + { + return (make_vector(x) - make_vector(y))[0]; + } + KFR_INTRIN friend complex operator*(const complex& x, const complex& y) + { + return (make_vector(x) * make_vector(y))[0]; + } + KFR_INTRIN friend complex operator/(const complex& x, const complex& y) + { + return (make_vector(x) / make_vector(y))[0]; + } + KFR_INTRIN friend complex operator-(const complex& x) + { + return (-make_vector(x))[0]; + } }; #endif #endif