1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-25 22:43:14 +00:00

Remove all warnings raised by bugprone-* clang-tidy checks in algorithm_libs

This commit is contained in:
Carles Fernandez 2020-07-10 22:06:29 +02:00
parent 1c4e4d3c67
commit 1e3d545034
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
18 changed files with 50 additions and 57 deletions

View File

@ -139,7 +139,7 @@ void beidou_b1i_code_gen_complex_sampled(own::span<std::complex<float>> _dest, u
constexpr float _tc = 1.0 / static_cast<float>(_codeFreqBasis); // B1I chip period in sec
const auto _samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
const float _ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
const float _ts = 1.0F / static_cast<float>(_fs); // Sampling period in sec
std::array<std::complex<float>, 2046> _code{};
int32_t _codeValueIndex;
@ -156,7 +156,7 @@ void beidou_b1i_code_gen_complex_sampled(own::span<std::complex<float>> _dest, u
// number of samples per millisecond (because one B1I code period is
// one millisecond).
aux = (_ts * (i + 1)) / _tc;
aux = (_ts * (static_cast<float>(i) + 1)) / _tc;
_codeValueIndex = AUX_CEIL(aux) - 1;
// --- Make the digitized version of the B1I code ------------------

View File

@ -202,7 +202,7 @@ void beidou_b3i_code_gen_complex_sampled(own::span<std::complex<float>> _dest, u
constexpr int32_t _codeLength = 10230;
constexpr float _tc = 1.0 / static_cast<float>(_codeFreqBasis); // B3I chip period in sec
const float _ts = 1.0 / static_cast<float>(_fs); // Sampling period in secs
const float _ts = 1.0F / static_cast<float>(_fs); // Sampling period in secs
const auto _samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
std::array<std::complex<float>, 10230> _code{};
@ -221,7 +221,7 @@ void beidou_b3i_code_gen_complex_sampled(own::span<std::complex<float>> _dest, u
// number of samples per millisecond (because one B3I code period is
// one millisecond).
aux = (_ts * (i + 1)) / _tc;
aux = (_ts * (static_cast<float>(i) + 1)) / _tc;
_codeValueIndex = AUX_CEIL(aux) - 1;
// --- Make the digitized version of the B3I code ------------------

View File

@ -36,7 +36,7 @@ byte_x2_to_complex_byte::byte_x2_to_complex_byte() : sync_block("byte_x2_to_comp
gr::io_signature::make(2, 2, sizeof(int8_t)), // int8_t, defined in stdint.h and included in volk.h (signed char)
gr::io_signature::make(1, 1, sizeof(lv_8sc_t))) // lv_8sc_t is a Volk's typedef for std::complex<signed char>
{
const int alignment_multiple = volk_gnsssdr_get_alignment() / sizeof(lv_8sc_t);
const auto alignment_multiple = static_cast<int>(volk_gnsssdr_get_alignment() / sizeof(lv_8sc_t));
set_alignment(std::max(1, alignment_multiple));
}

View File

@ -34,7 +34,7 @@ complex_byte_to_float_x2::complex_byte_to_float_x2() : sync_block("complex_byte_
gr::io_signature::make(1, 1, sizeof(lv_8sc_t)), // lv_8sc_t is a Volk's typedef for std::complex<signed char>
gr::io_signature::make(2, 2, sizeof(float)))
{
const int alignment_multiple = volk_get_alignment() / sizeof(float);
const auto alignment_multiple = static_cast<int>(volk_get_alignment() / sizeof(float));
set_alignment(std::max(1, alignment_multiple));
}

View File

@ -33,7 +33,7 @@ complex_float_to_complex_byte::complex_float_to_complex_byte() : sync_block("com
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(lv_8sc_t))) // lv_8sc_t is a Volk's typedef for std::complex<signed char>
{
const int alignment_multiple = volk_gnsssdr_get_alignment() / sizeof(lv_8sc_t);
const auto alignment_multiple = static_cast<int>(volk_gnsssdr_get_alignment() / sizeof(lv_8sc_t));
set_alignment(std::max(1, alignment_multiple));
}

View File

@ -33,7 +33,7 @@ conjugate_cc::conjugate_cc() : gr::sync_block("conjugate_cc",
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(gr_complex)))
{
const int alignment_multiple = volk_get_alignment() / sizeof(gr_complex);
const auto alignment_multiple = static_cast<int>(volk_get_alignment() / sizeof(gr_complex));
set_alignment(std::max(1, alignment_multiple));
}

View File

@ -33,7 +33,7 @@ conjugate_ic::conjugate_ic() : gr::sync_block("conjugate_ic",
gr::io_signature::make(1, 1, sizeof(lv_8sc_t)),
gr::io_signature::make(1, 1, sizeof(lv_8sc_t)))
{
const int alignment_multiple = volk_gnsssdr_get_alignment() / sizeof(lv_8sc_t);
const auto alignment_multiple = static_cast<int>(volk_gnsssdr_get_alignment() / sizeof(lv_8sc_t));
set_alignment(std::max(1, alignment_multiple));
}

View File

@ -32,7 +32,7 @@ conjugate_sc::conjugate_sc() : gr::sync_block("conjugate_sc",
gr::io_signature::make(1, 1, sizeof(lv_16sc_t)),
gr::io_signature::make(1, 1, sizeof(lv_16sc_t)))
{
const int alignment_multiple = volk_gnsssdr_get_alignment() / sizeof(lv_16sc_t);
const auto alignment_multiple = static_cast<int>(volk_gnsssdr_get_alignment() / sizeof(lv_16sc_t));
set_alignment(std::max(1, alignment_multiple));
}

View File

@ -22,6 +22,7 @@
#include "galileo_e1_signal_processing.h"
#include "Galileo_E1.h"
#include "gnss_signal_processing.h"
#include <cmath>
#include <memory>
#include <string>
#include <utility>
@ -112,8 +113,8 @@ void galileo_e1_code_gen_sinboc11_float(own::span<float> _dest, const std::array
void galileo_e1_gen_float(own::span<float> _dest, own::span<int> _prn, const std::array<char, 3>& _Signal)
{
constexpr uint32_t _codeLength = 12 * GALILEO_E1_B_CODE_LENGTH_CHIPS;
const float alpha = sqrt(10.0 / 11.0);
const float beta = sqrt(1.0 / 11.0);
const float alpha = std::sqrt(10.0F / 11.0F);
const float beta = std::sqrt(1.0F / 11.0F);
std::string _galileo_signal = _Signal.data();
@ -180,7 +181,7 @@ void galileo_e1_code_gen_float_sampled(own::span<float> _dest, const std::array<
{
std::vector<float> _resampled_signal(_samplesPerCode);
resampler(_signal_E1, _resampled_signal, _samplesPerChip * _codeFreqBasis, _fs); // resamples code to fs
resampler(_signal_E1, _resampled_signal, static_cast<float>(_samplesPerChip * _codeFreqBasis), _fs); // resamples code to fs
_signal_E1 = std::move(_resampled_signal);
}

View File

@ -748,7 +748,7 @@ int findUtmZone(double latitude_deg, double longitude_deg)
//
// Start at 180 deg west = -180 deg
int utmZone = floor((180 + longitude_deg) / 6) + 1;
auto utmZone = static_cast<int>(floor((180 + longitude_deg) / 6) + 1);
// Correct zone numbers for particular areas
if (latitude_deg > 72.0)

View File

@ -97,7 +97,7 @@ void glonass_l1_ca_code_gen_complex_sampled(own::span<std::complex<float>> _dest
constexpr int32_t _codeLength = 511;
constexpr float _tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
const float _ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
const float _ts = 1.0F / static_cast<float>(_fs); // Sampling period in sec
const auto _samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
std::array<std::complex<float>, 511> _code{};
@ -115,7 +115,7 @@ void glonass_l1_ca_code_gen_complex_sampled(own::span<std::complex<float>> _dest
// number of samples per millisecond (because one C/A code period is one
// millisecond).
aux = (_ts * (i + 1)) / _tc;
aux = (_ts * (static_cast<float>(i) + 1)) / _tc;
_codeValueIndex = AUX_CEIL(aux) - 1;
// --- Make the digitized version of the C/A code ------------------

View File

@ -98,7 +98,7 @@ void glonass_l2_ca_code_gen_complex_sampled(own::span<std::complex<float>> _dest
constexpr float _tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
const auto _samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
const float _ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
const float _ts = 1.0F / static_cast<float>(_fs); // Sampling period in sec
std::array<std::complex<float>, 511> _code{};
int32_t _codeValueIndex;
@ -115,7 +115,7 @@ void glonass_l2_ca_code_gen_complex_sampled(own::span<std::complex<float>> _dest
// number of samples per millisecond (because one C/A code period is one
// millisecond).
aux = (_ts * (i + 1)) / _tc;
aux = (_ts * (static_cast<float>(i) + 1)) / _tc;
_codeValueIndex = AUX_CEIL(aux) - 1;
// --- Make the digitized version of the C/A code ------------------

View File

@ -30,7 +30,7 @@ const auto AUX_CEIL2 = [](float x) { return static_cast<int32_t>(static_cast<int
void complex_exp_gen(own::span<std::complex<float>> _dest, double _f, double _fs)
{
gr::fxpt_nco d_nco;
d_nco.set_freq((TWO_PI * _f) / _fs);
d_nco.set_freq(static_cast<float>((TWO_PI * _f) / _fs));
d_nco.sincos(_dest.data(), _dest.size(), 1);
}
@ -38,7 +38,7 @@ void complex_exp_gen(own::span<std::complex<float>> _dest, double _f, double _fs
void complex_exp_gen_conj(own::span<std::complex<float>> _dest, double _f, double _fs)
{
gr::fxpt_nco d_nco;
d_nco.set_freq(-(TWO_PI * _f) / _fs);
d_nco.set_freq(-static_cast<float>((TWO_PI * _f) / _fs));
d_nco.sincos(_dest.data(), _dest.size(), 1);
}
@ -155,13 +155,13 @@ void resampler(const own::span<float> _from, own::span<float> _dest, float _fs_i
uint32_t _codeValueIndex;
float aux;
// --- Find time constants -------------------------------------------------
const float _t_in = 1 / _fs_in; // Incoming sampling period in sec
const float _t_out = 1 / _fs_out; // Out sampling period in sec
const float _t_in = 1.0F / _fs_in; // Incoming sampling period in sec
const float _t_out = 1.0F / _fs_out; // Out sampling period in sec
for (size_t i = 0; i < _dest.size() - 1; i++)
{
// === Digitizing ==================================================
// --- compute index array to read sampled values ------------------
aux = (_t_out * (i + 1)) / _t_in;
aux = (_t_out * (static_cast<float>(i) + 1.0F)) / _t_in;
_codeValueIndex = AUX_CEIL2(aux) - 1;
// if repeat the chip -> upsample by nearest neighborhood interpolation
@ -178,13 +178,13 @@ void resampler(own::span<const std::complex<float>> _from, own::span<std::comple
uint32_t _codeValueIndex;
float aux;
// --- Find time constants -------------------------------------------------
const float _t_in = 1 / _fs_in; // Incoming sampling period in sec
const float _t_out = 1 / _fs_out; // Out sampling period in sec
const float _t_in = 1.0F / _fs_in; // Incoming sampling period in sec
const float _t_out = 1.0F / _fs_out; // Out sampling period in sec
for (size_t i = 0; i < _dest.size() - 1; i++)
{
// === Digitizing ==================================================
// --- compute index array to read sampled values ------------------
aux = (_t_out * (i + 1)) / _t_in;
aux = (_t_out * (static_cast<float>(i) + 1.0F)) / _t_in;
_codeValueIndex = AUX_CEIL2(aux) - 1;
// if repeat the chip -> upsample by nearest neighborhood interpolation

View File

@ -54,7 +54,7 @@ void gps_l2c_m_code_gen_complex(own::span<std::complex<float>> _dest, uint32_t _
for (int32_t i = 0; i < GPS_L2_M_CODE_LENGTH_CHIPS; i++)
{
_dest[i] = std::complex<float>(0.0, 1.0 - 2.0 * _code[i]);
_dest[i] = std::complex<float>(0.0, 1.0F - 2.0F * _code[i]);
}
}
@ -80,10 +80,10 @@ void gps_l2c_m_code_gen_float(own::span<float> _dest, uint32_t _prn)
void gps_l2c_m_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint32_t _prn, int32_t _fs)
{
constexpr int32_t _codeLength = GPS_L2_M_CODE_LENGTH_CHIPS;
constexpr float _tc = 1.0 / static_cast<float>(GPS_L2_M_CODE_RATE_CPS); // L2C chip period in sec
constexpr float _tc = 1.0F / static_cast<float>(GPS_L2_M_CODE_RATE_CPS); // L2C chip period in sec
const auto _samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(GPS_L2_M_CODE_RATE_CPS) / static_cast<double>(_codeLength)));
const float _ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
const float _ts = 1.0F / static_cast<float>(_fs); // Sampling period in sec
int32_t _codeValueIndex;
std::array<int32_t, GPS_L2_M_CODE_LENGTH_CHIPS> _code{};
@ -97,17 +97,17 @@ void gps_l2c_m_code_gen_complex_sampled(own::span<std::complex<float>> _dest, ui
// === Digitizing ==================================================
// --- Make index array to read L2C code values --------------------
_codeValueIndex = std::ceil((_ts * (static_cast<float>(i) + 1)) / _tc) - 1;
_codeValueIndex = std::ceil((_ts * (static_cast<float>(i) + 1.0F)) / _tc) - 1;
// --- Make the digitized version of the L2C code ------------------
if (i == _samplesPerCode - 1)
{
// --- Correct the last index (due to number rounding issues) -----------
_dest[i] = std::complex<float>(0.0, 1.0 - 2.0 * _code[_codeLength - 1]);
_dest[i] = std::complex<float>(0.0, 1.0F - 2.0F * _code[_codeLength - 1]);
}
else
{
_dest[i] = std::complex<float>(0.0, 1.0 - 2.0 * _code[_codeValueIndex]); // repeat the chip -> upsample
_dest[i] = std::complex<float>(0.0, 1.0F - 2.0F * _code[_codeValueIndex]); // repeat the chip -> upsample
}
}
}

View File

@ -171,7 +171,7 @@ void gps_l5i_code_gen_complex(own::span<std::complex<float>> _dest, uint32_t _pr
for (int32_t i = 0; i < GPS_L5I_CODE_LENGTH_CHIPS; i++)
{
_dest[i] = std::complex<float>(1.0 - 2.0 * static_cast<float>(_code[i]), 0.0);
_dest[i] = std::complex<float>(1.0F - 2.0F * static_cast<float>(_code[i]), 0.0);
}
}
@ -186,7 +186,7 @@ void gps_l5i_code_gen_float(own::span<float> _dest, uint32_t _prn)
for (int32_t i = 0; i < GPS_L5I_CODE_LENGTH_CHIPS; i++)
{
_dest[i] = 1.0 - 2.0 * static_cast<float>(_code[i]);
_dest[i] = 1.0F - 2.0F * static_cast<float>(_code[i]);
}
}
@ -200,7 +200,7 @@ void gps_l5i_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint
constexpr float _tc = 1.0 / static_cast<float>(GPS_L5I_CODE_RATE_CPS); // L5I primary chip period in sec
const auto _samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(GPS_L5I_CODE_RATE_CPS) / static_cast<double>(_codeLength)));
const float _ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
const float _ts = 1.0F / static_cast<float>(_fs); // Sampling period in sec
int32_t _codeValueIndex;
std::array<int32_t, GPS_L5I_CODE_LENGTH_CHIPS> _code{};
@ -214,17 +214,17 @@ void gps_l5i_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint
// === Digitizing ==================================================
// --- Make index array to read L5 code values ---------------------
_codeValueIndex = static_cast<int32_t>(std::ceil(_ts * static_cast<float>(i + 1) / _tc)) - 1;
_codeValueIndex = static_cast<int32_t>(std::ceil(_ts * static_cast<float>(i + 1.0F) / _tc)) - 1;
// --- Make the digitized version of the L5I code ------------------
if (i == _samplesPerCode - 1)
{
// --- Correct the last index (due to number rounding issues) -----------
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[_codeLength - 1], 0.0);
_dest[i] = std::complex<float>(1.0F - 2.0F * _code[_codeLength - 1], 0.0);
}
else
{
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[_codeValueIndex], 0.0); // repeat the chip -> upsample
_dest[i] = std::complex<float>(1.0F - 2.0F * _code[_codeValueIndex], 0.0); // repeat the chip -> upsample
}
}
}
@ -240,7 +240,7 @@ void gps_l5q_code_gen_complex(own::span<std::complex<float>> _dest, uint32_t _pr
for (int32_t i = 0; i < GPS_L5Q_CODE_LENGTH_CHIPS; i++)
{
_dest[i] = std::complex<float>(0.0, 1.0 - 2.0 * static_cast<float>(_code[i]));
_dest[i] = std::complex<float>(0.0, 1.0F - 2.0F * static_cast<float>(_code[i]));
}
}
@ -281,25 +281,25 @@ void gps_l5q_code_gen_complex_sampled(own::span<std::complex<float>> _dest, uint
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(GPS_L5Q_CODE_RATE_CPS) / static_cast<double>(_codeLength)));
// --- Find time constants -------------------------------------------------
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
_tc = 1.0 / static_cast<float>(GPS_L5Q_CODE_RATE_CPS); // L5Q chip period in sec
_ts = 1.0F / static_cast<float>(_fs); // Sampling period in sec
_tc = 1.0F / static_cast<float>(GPS_L5Q_CODE_RATE_CPS); // L5Q chip period in sec
for (int32_t i = 0; i < _samplesPerCode; i++)
{
// === Digitizing ==================================================
// --- Make index array to read L5 code values ---------------------
_codeValueIndex = static_cast<int32_t>(std::ceil(_ts * static_cast<float>(i + 1) / _tc)) - 1;
_codeValueIndex = static_cast<int32_t>(std::ceil(_ts * static_cast<float>(i + 1.0F) / _tc)) - 1;
// --- Make the digitized version of the L5Q code ------------------
if (i == _samplesPerCode - 1)
{
// --- Correct the last index (due to number rounding issues) -----------
_dest[i] = std::complex<float>(0.0, 1.0 - 2.0 * _code[_codeLength - 1]);
_dest[i] = std::complex<float>(0.0, 1.0F - 2.0F * _code[_codeLength - 1]);
}
else
{
_dest[i] = std::complex<float>(0.0, 1.0 - 2.0 * _code[_codeValueIndex]); // repeat the chip -> upsample
_dest[i] = std::complex<float>(0.0, 1.0F - 2.0F * _code[_codeValueIndex]); // repeat the chip -> upsample
}
}
}

View File

@ -150,7 +150,7 @@ void gps_l1_ca_code_gen_complex_sampled(own::span<std::complex<float>> _dest, ui
constexpr float _tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
const auto _samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
const float _ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
const float _ts = 1.0F / static_cast<float>(_fs); // Sampling period in sec
std::array<std::complex<float>, 1023> _code{};
int32_t _codeValueIndex;
float aux;
@ -166,7 +166,7 @@ void gps_l1_ca_code_gen_complex_sampled(own::span<std::complex<float>> _dest, ui
// number of samples per millisecond (because one C/A code period is one
// millisecond).
aux = (_ts * (i + 1)) / _tc;
aux = (_ts * (static_cast<float>(i) + 1)) / _tc;
_codeValueIndex = AUX_CEIL(aux) - 1;
// --- Make the digitized version of the C/A code -------------------

View File

@ -59,11 +59,7 @@ Pass_Through::Pass_Through(const ConfigurationInterface* configuration, const st
conjugate_cc_ = make_conjugate_cc();
}
}
else if (item_type_ == "short")
{
item_size_ = sizeof(int16_t);
}
else if (item_type_ == "ishort")
else if ((item_type_ == "short") || (item_type_ == "ishort"))
{
item_size_ = sizeof(int16_t);
}
@ -75,11 +71,7 @@ Pass_Through::Pass_Through(const ConfigurationInterface* configuration, const st
conjugate_sc_ = make_conjugate_sc();
}
}
else if (item_type_ == "byte")
{
item_size_ = sizeof(int8_t);
}
else if (item_type_ == "ibyte")
else if ((item_type_ == "byte") || (item_type_ == "ibyte"))
{
item_size_ = sizeof(int8_t);
}

View File

@ -34,7 +34,7 @@ short_x2_to_cshort::short_x2_to_cshort() : sync_block("short_x2_to_cshort",
gr::io_signature::make(2, 2, sizeof(int16_t)),
gr::io_signature::make(1, 1, sizeof(lv_16sc_t)))
{
const int alignment_multiple = volk_gnsssdr_get_alignment() / sizeof(lv_16sc_t);
const auto alignment_multiple = static_cast<int>(volk_gnsssdr_get_alignment() / sizeof(lv_16sc_t));
set_alignment(std::max(1, alignment_multiple));
}