diff options
author | Martin Braun <martin.braun@ettus.com> | 2021-07-20 15:23:32 +0200 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-07-23 09:55:49 -0500 |
commit | 5683b30c8f62a0dc176cefbab25b56760363e878 (patch) | |
tree | 598b3d630e33251fdaead3d4069ceb11c0aad44d | |
parent | 0d9667e6968dd1e6edda62693ab6a858849d3a08 (diff) | |
download | uhd-5683b30c8f62a0dc176cefbab25b56760363e878.tar.gz uhd-5683b30c8f62a0dc176cefbab25b56760363e878.tar.bz2 uhd-5683b30c8f62a0dc176cefbab25b56760363e878.zip |
uhd: Fix usage of std::abs with template parameters
`std::abs` is only a templated function, when dealing with complex
numbers. For real values, it is an overload. There is no
documented standard way to use `std::abs<double>()` for real-valued
arguments. We therefore remove all usages of `std::abs<>()` and
replace them with `std::abs()` where they were taking a real-valued
argument.
-rw-r--r-- | host/lib/usrp/cores/rx_dsp_core_3000.cpp | 2 | ||||
-rw-r--r-- | host/tests/rfnoc_block_tests/x4xx_radio_block_test.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/host/lib/usrp/cores/rx_dsp_core_3000.cpp b/host/lib/usrp/cores/rx_dsp_core_3000.cpp index 1c15180ae..2c6aad014 100644 --- a/host/lib/usrp/cores/rx_dsp_core_3000.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_3000.cpp @@ -260,7 +260,7 @@ public: uhd::meta_range_t get_freq_range(void) override { // Too keep the DSP range symmetric about 0, we use abs(_dsp_freq_offset) - const double offset = std::abs<double>(_dsp_freq_offset); + const double offset = std::abs(_dsp_freq_offset); return uhd::meta_range_t(-(_tick_rate - offset) / 2, +(_tick_rate - offset) / 2, _tick_rate / std::pow(2.0, 32)); diff --git a/host/tests/rfnoc_block_tests/x4xx_radio_block_test.cpp b/host/tests/rfnoc_block_tests/x4xx_radio_block_test.cpp index 2f2e51d60..5583cec6f 100644 --- a/host/tests/rfnoc_block_tests/x4xx_radio_block_test.cpp +++ b/host/tests/rfnoc_block_tests/x4xx_radio_block_test.cpp @@ -896,8 +896,8 @@ BOOST_FIXTURE_TEST_CASE(zbx_tx_power_api, x400_radio_fixture) test_radio->set_tx_frequency(freq, chan); // If the tracking mode is properly set, we should not deviate much // regarding power - const double pow_diff = std::abs<double>( - tx_given_power - test_radio->get_tx_power_reference(chan)); + const double pow_diff = + std::abs(tx_given_power - test_radio->get_tx_power_reference(chan)); BOOST_CHECK_MESSAGE(pow_diff < 3.0, "power differential is too large: " << pow_diff); // Back to gain mode @@ -928,7 +928,7 @@ BOOST_FIXTURE_TEST_CASE(zbx_rx_power_api, x400_radio_fixture) // If the tracking mode is properly set, we should match our expected criteria // for power reference levels const double actual_power = test_radio->get_rx_power_reference(chan); - const double pow_diff = std::abs<double>(rx_given_power - actual_power); + const double pow_diff = std::abs(rx_given_power - actual_power); BOOST_CHECK_MESSAGE(pow_diff < 3.0, "power differential is too large (" << pow_diff << "): Expected close to: " << rx_given_power |