diff --git a/modemm17/FrequencyError.h b/modemm17/FrequencyError.h index 0da9163fc..43deda7af 100644 --- a/modemm17/FrequencyError.h +++ b/modemm17/FrequencyError.h @@ -14,27 +14,12 @@ namespace modemm17 template struct FrequencyError { - using float_type = float; - using array_t = std::array; - using filter_type = BaseIirFilter<3>; - - static constexpr std::array evm_b{0.02008337, 0.04016673, 0.02008337}; - static constexpr std::array evm_a{1.0, -1.56101808, 0.64135154}; - - array_t samples_{0}; - size_t index_ = 0; - float_type accum_ = 0.0; - filter_type filter_{makeIirFilter(evm_b, evm_a)}; - - - const float_type ZERO = 0.0; - - FrequencyError() + FrequencyError() : { - samples_.fill(0.0); + samples_.fill(0.0f); } - auto operator()(float_type sample) + auto operator()(float sample) { float evm = 0; bool use = true; @@ -61,6 +46,17 @@ struct FrequencyError return filter_(accum_ / N); } + +private: + static constexpr std::array evm_b{0.02008337, 0.04016673, 0.02008337}; + static constexpr std::array evm_a{1.0, -1.56101808, 0.64135154}; + + std::array samples_; + size_t index_ = 0; + float accum_ = 0.0f; + BaseIirFilter<3> filter_{makeIirFilter(evm_b, evm_a)}; + + const float ZERO = 0.0f; }; } // modemm17 diff --git a/modemm17/Golay24.h b/modemm17/Golay24.h index 9d9e14cb1..cf9b9ecf6 100644 --- a/modemm17/Golay24.h +++ b/modemm17/Golay24.h @@ -22,7 +22,7 @@ namespace Golay24_detail // Need a constexpr sort. // https://stackoverflow.com/a/40030044/854133 template -constexpr void swap(T& l, T& r) +static void swap(T& l, T& r) { T tmp = std::move(l); l = std::move(r); @@ -52,7 +52,7 @@ struct array }; template -constexpr void sort_impl(array &array, size_t left, size_t right) +static void sort_impl(array &array, size_t left, size_t right) { if (left < right) { @@ -70,7 +70,7 @@ constexpr void sort_impl(array &array, size_t left, size_t right) } template -constexpr array sort(array array) +static array sort(array array) { auto sorted = array; sort_impl(sorted, 0, N);