Small correction,of previous PR , about New_Feature_GCC_10_Compile_errors_#199 (based on sharebrained indications)

This commit is contained in:
Brumi-2021 2021-10-25 18:11:31 +02:00
parent f4db4e2b53
commit ab8f93805d
2 changed files with 6 additions and 5 deletions

View File

@ -27,8 +27,6 @@
#include "event_m4.hpp"
#include "portapack_shared_memory.hpp"
/* #include "event_m4.hpp" that line is duplicated, we can delete it .*/
#include <algorithm>
void SpectrumCollector::on_message(const Message* const message) {
@ -121,13 +119,13 @@ void SpectrumCollector::post_message(const buffer_c16_t& data) {
template<typename T> // Although currently we are not using that Windowing shape, we apply the same GCC10 compile error c/m
static typename T::value_type spectrum_window_none(const T& s, const size_t i) {
static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions.
static_assert(power_of_two(ARRAY_ELEMENTS(s)), "Array number of elements must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions.
return s[i];
};
template<typename T> // Currently we are calling and using that Window shape.
static typename T::value_type spectrum_window_hamming_3(const T& s, const size_t i) {
static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions.
static_assert(power_of_two(ARRAY_ELEMENTS(s)), "Array number of elements must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions.
const size_t mask = s.size() - 1; // c/m compile error GCC10 , constexpr->const
// Three point Hamming window.
return s[i] * 0.54f + (s[(i-1) & mask] + s[(i+1) & mask]) * -0.23f;
@ -135,7 +133,7 @@ static typename T::value_type spectrum_window_hamming_3(const T& s, const size_t
template<typename T> // Although currently we are not using that Windowing shape, we apply the same GCC10 compile error c/m
static typename T::value_type spectrum_window_blackman_3(const T& s, const size_t i) {
static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions.
static_assert(power_of_two(ARRAY_ELEMENTS(s)), "Array number of elements must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions.
const size_t mask = s.size() - 1; // c/m compile error GCC10 , constexpr->const
// Three term Blackman window.
constexpr float alpha = 0.42f;

View File

@ -22,6 +22,9 @@
#ifndef __SPECTRUM_COLLECTOR_H__
#define __SPECTRUM_COLLECTOR_H__
#define ARRAY_ELEMENTS(x) (sizeof(x) / sizeof(x[0]))
/* sizeof() compile-time operator that returns #bytes of (data type). We used it to get #elements_array */
#include "dsp_types.hpp"
#include "complex.hpp"