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 afcb1185af64d8e380dc03c0591e7a281c0a50ed
parent d1cc7eb25dae0d9ca7063e6fe4b376cb6b5ec184
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date:   Thu, 21 Dec 2023 13:08:55 +0000

is_between

Diffstat:
Minclude/kfr/cometa.hpp | 18++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/include/kfr/cometa.hpp b/include/kfr/cometa.hpp @@ -1348,41 +1348,47 @@ struct fn_return_constant }; template <typename T1, typename T2> -CMT_INTRINSIC bool is_equal(const T1& x, const T2& y) +CMT_INTRINSIC constexpr bool is_equal(const T1& x, const T2& y) { return x == y; } template <typename T1, typename T2> -CMT_INTRINSIC bool is_notequal(const T1& x, const T2& y) +CMT_INTRINSIC constexpr bool is_notequal(const T1& x, const T2& y) { return x != y; } template <typename T1, typename T2> -CMT_INTRINSIC bool is_less(const T1& x, const T2& y) +CMT_INTRINSIC constexpr bool is_less(const T1& x, const T2& y) { return x < y; } template <typename T1, typename T2> -CMT_INTRINSIC bool is_greater(const T1& x, const T2& y) +CMT_INTRINSIC constexpr bool is_greater(const T1& x, const T2& y) { return x > y; } template <typename T1, typename T2> -CMT_INTRINSIC bool is_lessorequal(const T1& x, const T2& y) +CMT_INTRINSIC constexpr bool is_lessorequal(const T1& x, const T2& y) { return x <= y; } template <typename T1, typename T2> -CMT_INTRINSIC bool is_greaterorequal(const T1& x, const T2& y) +CMT_INTRINSIC constexpr bool is_greaterorequal(const T1& x, const T2& y) { return x >= y; } +template <typename T> +CMT_INTRINSIC constexpr bool is_between(T value, identity<T> min, identity<T> max) +{ + return value >= min && value <= max; +} CMT_FN(is_equal) CMT_FN(is_notequal) CMT_FN(is_less) CMT_FN(is_greater) CMT_FN(is_lessorequal) CMT_FN(is_greaterorequal) +CMT_FN(is_between) namespace details {