Added macro for calculating the squared absolute value of a complex variable

This commit is contained in:
Xavier Arteaga 2021-05-05 15:36:01 +02:00 committed by Xavier Arteaga
parent 653177ca7c
commit fd0d804321
1 changed files with 3 additions and 0 deletions

View File

@ -44,6 +44,9 @@ extern "C" {
#define SRSRAN_FLOOR(NUM, DEN) ((NUM) / (DEN))
#define SRSRAN_ROUND(NUM, DEN) ((uint32_t)round((double)(NUM) / (double)(DEN)))
// Complex squared absolute value
#define SRSRAN_CSQABS(X) (__real__(X) * __real__(X) + __imag__(X) * __imag__(X))
// Cumulative moving average
#define SRSRAN_VEC_CMA(data, average, n) ((average) + ((data) - (average)) / ((n) + 1))