From c51a8bfe9d4d313af601b29b74bf98f35dc03b61 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Fri, 26 Apr 2019 12:46:30 +0100 Subject: [PATCH] Fix compilation error when using GCC 8, C++11 and C complex functions. --- srsenb/src/phy/sf_worker.cc | 4 ++-- srsue/src/phy/cc_worker.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/srsenb/src/phy/sf_worker.cc b/srsenb/src/phy/sf_worker.cc index a33d42251..9f004e2c0 100644 --- a/srsenb/src/phy/sf_worker.cc +++ b/srsenb/src/phy/sf_worker.cc @@ -886,7 +886,7 @@ int sf_worker::read_ce_abs(float* ce_abs) bzero(ce_abs, sizeof(float) * sz); int g = (sz - 12 * phy->cell.nof_prb) / 2; for (i = 0; i < 12 * phy->cell.nof_prb; i++) { - ce_abs[g + i] = 20 * log10(cabs(enb_ul.chest_res.ce[i])); + ce_abs[g + i] = 20 * log10(std::abs(std::complex(enb_ul.chest_res.ce[i]))); if (isinf(ce_abs[g + i])) { ce_abs[g + i] = -80; } @@ -901,7 +901,7 @@ int sf_worker::read_ce_arg(float* ce_arg) bzero(ce_arg, sizeof(float) * sz); int g = (sz - 12 * phy->cell.nof_prb) / 2; for (i = 0; i < 12 * phy->cell.nof_prb; i++) { - ce_arg[g + i] = cargf(enb_ul.chest_res.ce[i]) * 180.0f / (float)M_PI; + ce_arg[g + i] = std::arg(std::complex(enb_ul.chest_res.ce[i])) * 180.0f / (float)M_PI; if (isinf(ce_arg[g + i])) { ce_arg[g + i] = -80; } diff --git a/srsue/src/phy/cc_worker.cc b/srsue/src/phy/cc_worker.cc index 116315fb7..ab243bca2 100644 --- a/srsue/src/phy/cc_worker.cc +++ b/srsue/src/phy/cc_worker.cc @@ -1402,7 +1402,7 @@ int cc_worker::read_ce_abs(float* ce_abs, uint32_t tx_antenna, uint32_t rx_anten bzero(ce_abs, sizeof(float) * sz); int g = (sz - 12 * cell.nof_prb) / 2; for (i = 0; i < 12 * cell.nof_prb; i++) { - ce_abs[g + i] = 20 * log10f(cabsf(ue_dl.chest_res.ce[tx_antenna][rx_antenna][i])); + ce_abs[g + i] = 20 * log10f(std::abs(std::complex(ue_dl.chest_res.ce[tx_antenna][rx_antenna][i]))); if (std::isinf(ce_abs[g + i])) { ce_abs[g + i] = -80; }