1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-18 11:09:56 +00:00

Remove bound checking when accessing elements

This commit is contained in:
Carles Fernandez 2019-09-09 19:08:15 +02:00
parent c8cd925ba8
commit a1aaf8aff0
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 9 additions and 11 deletions

View File

@ -212,7 +212,7 @@ void galileo_e1_code_gen_float_sampled(gsl::span<float> _dest, const std::array<
{
for (unsigned k = 0; k < _samplesPerCode; k++)
{
_signal_E1C_secondary_span[i * _samplesPerCode + k] = _signal_E1_span_aux[k] * (GALILEO_E1_C_SECONDARY_CODE.at(i) == '0' ? 1.0F : -1.0F);
_signal_E1C_secondary_span[i * _samplesPerCode + k] = _signal_E1_span_aux[k] * (GALILEO_E1_C_SECONDARY_CODE[i] == '0' ? 1.0F : -1.0F);
}
}

View File

@ -4,8 +4,6 @@
* as replica code generation
* \author Marc Sales, 2014. marcsales92(at)gmail.com
*
* Detailed description of the file here if needed.
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
@ -52,7 +50,7 @@ void galileo_e5_a_code_gen_complex_primary(gsl::span<std::complex<float>> _dest,
{
for (size_t i = 0; i < GALILEO_E5A_Q_PRIMARY_CODE[prn].length() - 1; i++)
{
hex_to_binary_converter(a, GALILEO_E5A_Q_PRIMARY_CODE[prn].at(i));
hex_to_binary_converter(a, GALILEO_E5A_Q_PRIMARY_CODE[prn][i]);
_dest[index] = std::complex<float>(0.0, static_cast<float>(a[0]));
_dest[index + 1] = std::complex<float>(0.0, static_cast<float>(a[1]));
_dest[index + 2] = std::complex<float>(0.0, static_cast<float>(a[2]));
@ -60,7 +58,7 @@ void galileo_e5_a_code_gen_complex_primary(gsl::span<std::complex<float>> _dest,
index = index + 4;
}
// last 2 bits are filled up zeros
hex_to_binary_converter(a, GALILEO_E5A_Q_PRIMARY_CODE[prn].at(GALILEO_E5A_Q_PRIMARY_CODE[prn].length() - 1));
hex_to_binary_converter(a, GALILEO_E5A_Q_PRIMARY_CODE[prn][GALILEO_E5A_Q_PRIMARY_CODE[prn].length() - 1]);
_dest[index] = std::complex<float>(0.0, static_cast<float>(a[0]));
_dest[index + 1] = std::complex<float>(0.0, static_cast<float>(a[1]));
}
@ -68,7 +66,7 @@ void galileo_e5_a_code_gen_complex_primary(gsl::span<std::complex<float>> _dest,
{
for (size_t i = 0; i < GALILEO_E5A_I_PRIMARY_CODE[prn].length() - 1; i++)
{
hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn].at(i));
hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn][i]);
_dest[index] = std::complex<float>(static_cast<float>(a[0]), 0.0);
_dest[index + 1] = std::complex<float>(static_cast<float>(a[1]), 0.0);
_dest[index + 2] = std::complex<float>(static_cast<float>(a[2]), 0.0);
@ -76,7 +74,7 @@ void galileo_e5_a_code_gen_complex_primary(gsl::span<std::complex<float>> _dest,
index = index + 4;
}
// last 2 bits are filled up zeros
hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn].at(GALILEO_E5A_I_PRIMARY_CODE[prn].length() - 1));
hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn][GALILEO_E5A_I_PRIMARY_CODE[prn].length() - 1]);
_dest[index] = std::complex<float>(static_cast<float>(a[0]), 0.0);
_dest[index + 1] = std::complex<float>(static_cast<float>(a[1]), 0.0);
}
@ -85,8 +83,8 @@ void galileo_e5_a_code_gen_complex_primary(gsl::span<std::complex<float>> _dest,
std::array<int32_t, 4> b{};
for (size_t i = 0; i < GALILEO_E5A_I_PRIMARY_CODE[prn].length() - 1; i++)
{
hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn].at(i));
hex_to_binary_converter(b, GALILEO_E5A_Q_PRIMARY_CODE[prn].at(i));
hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn][i]);
hex_to_binary_converter(b, GALILEO_E5A_Q_PRIMARY_CODE[prn][i]);
_dest[index] = std::complex<float>(static_cast<float>(a[0]), static_cast<float>(b[0]));
_dest[index + 1] = std::complex<float>(static_cast<float>(a[1]), static_cast<float>(b[1]));
_dest[index + 2] = std::complex<float>(static_cast<float>(a[2]), static_cast<float>(b[2]));
@ -94,8 +92,8 @@ void galileo_e5_a_code_gen_complex_primary(gsl::span<std::complex<float>> _dest,
index = index + 4;
}
// last 2 bits are filled up zeros
hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn].at(GALILEO_E5A_I_PRIMARY_CODE[prn].length() - 1));
hex_to_binary_converter(b, GALILEO_E5A_Q_PRIMARY_CODE[prn].at(GALILEO_E5A_Q_PRIMARY_CODE[prn].length() - 1));
hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn][GALILEO_E5A_I_PRIMARY_CODE[prn].length() - 1]);
hex_to_binary_converter(b, GALILEO_E5A_Q_PRIMARY_CODE[prn][GALILEO_E5A_Q_PRIMARY_CODE[prn].length() - 1]);
_dest[index] = std::complex<float>(static_cast<float>(a[0]), static_cast<float>(b[0]));
_dest[index + 1] = std::complex<float>(static_cast<float>(a[1]), static_cast<float>(b[1]));
}