From 676080d6afb29faef0ed46a8eeda4a8a36a9a022 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Thu, 10 Jun 2021 19:09:29 +0200 Subject: [PATCH] Added macro SRSRAN_VEC_SAFE_CMA --- lib/include/srsran/phy/utils/vector.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/include/srsran/phy/utils/vector.h b/lib/include/srsran/phy/utils/vector.h index e3f922ca9..087cb8009 100644 --- a/lib/include/srsran/phy/utils/vector.h +++ b/lib/include/srsran/phy/utils/vector.h @@ -50,6 +50,9 @@ extern "C" { // Cumulative moving average #define SRSRAN_VEC_CMA(data, average, n) ((average) + ((data) - (average)) / ((n) + 1)) +// Cumulative moving average +#define SRSRAN_VEC_SAFE_CMA(data, average, n) (isnormal(average) ? SRSRAN_VEC_CMA(data, average, n) : (data)) + // Proportional moving average #define SRSRAN_VEC_PMA(average1, n1, average2, n2) (((average1) * (n1) + (average2) * (n2)) / ((n1) + (n2)))