From 8743713bb12669320392bc56e89ce2db31c1359c Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Thu, 10 Jun 2021 19:46:33 +0200 Subject: [PATCH] Fix compilation --- lib/include/srsran/phy/utils/vector.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/include/srsran/phy/utils/vector.h b/lib/include/srsran/phy/utils/vector.h index 087cb8009..ce8566eb4 100644 --- a/lib/include/srsran/phy/utils/vector.h +++ b/lib/include/srsran/phy/utils/vector.h @@ -51,7 +51,11 @@ extern "C" { #define SRSRAN_VEC_CMA(data, average, n) ((average) + ((data) - (average)) / ((n) + 1)) // Cumulative moving average +#ifdef __cplusplus +#define SRSRAN_VEC_SAFE_CMA(data, average, n) (std::isnormal(average) ? SRSRAN_VEC_CMA(data, average, n) : (data)) +#else #define SRSRAN_VEC_SAFE_CMA(data, average, n) (isnormal(average) ? SRSRAN_VEC_CMA(data, average, n) : (data)) +#endif // Proportional moving average #define SRSRAN_VEC_PMA(average1, n1, average2, n2) (((average1) * (n1) + (average2) * (n2)) / ((n1) + (n2))) @@ -60,7 +64,12 @@ extern "C" { #define SRSRAN_VEC_EMA(data, average, alpha) ((alpha) * (data) + (1 - alpha) * (average)) // Safe exponential moving average +#ifdef __cplusplus +#define SRSRAN_VEC_SAFE_EMA(data, average, alpha) \ + (std::isnormal(average) ? SRSRAN_VEC_EMA(data, average, alpha) : (data)) +#else #define SRSRAN_VEC_SAFE_EMA(data, average, alpha) (isnormal(average) ? SRSRAN_VEC_EMA(data, average, alpha) : (data)) +#endif static inline float srsran_convert_amplitude_to_dB(float v) {