From aa3a2a3dba563540d98987a20d8de34389291ebc Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Wed, 13 Mar 2019 10:53:33 +0000 Subject: [PATCH] Fix compilation issue with GCC 8.x using complex numbers. --- srsenb/src/phy/phch_worker.cc | 4 ++-- srsue/src/phy/phch_worker.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/srsenb/src/phy/phch_worker.cc b/srsenb/src/phy/phch_worker.cc index 9f24168a3..4bf79fdd9 100644 --- a/srsenb/src/phy/phch_worker.cc +++ b/srsenb/src/phy/phch_worker.cc @@ -1104,7 +1104,7 @@ int phch_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.ce[i])); + ce_abs[g+i] = 20 * log10(std::abs(std::complex(enb_ul.ce[i]))); if (std::isinf(ce_abs[g + i])) { ce_abs[g+i] = -80; } @@ -1118,7 +1118,7 @@ int phch_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.ce[i]) * 180.0f / (float) M_PI; + ce_arg[g+i] = std::arg(std::complex(enb_ul.ce[i])) * 180.0f / (float) M_PI; if (std::isinf(ce_arg[g + i])) { ce_arg[g+i] = -80; } diff --git a/srsue/src/phy/phch_worker.cc b/srsue/src/phy/phch_worker.cc index fb7869bd3..8f782f355 100644 --- a/srsue/src/phy/phch_worker.cc +++ b/srsue/src/phy/phch_worker.cc @@ -1590,7 +1590,7 @@ int phch_worker::read_ce_abs(float *ce_abs, uint32_t tx_antenna, uint32_t rx_ant 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.ce_m[tx_antenna][rx_antenna][i])); + ce_abs[g+i] = 20 * log10f(std::abs(std::complex(ue_dl.ce_m[tx_antenna][rx_antenna][i]))); if (std::isinf(ce_abs[g + i])) { ce_abs[g+i] = -80; }