Remove useless casts

This commit is contained in:
Carles Fernandez 2023-11-14 13:42:44 +01:00
parent 8f13192aa6
commit 7132ee720a
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
18 changed files with 76 additions and 76 deletions

View File

@ -171,9 +171,9 @@ void An_Packet_Printer::update_sdr_gnss_packet(sdr_gnss_packet_t* _packet, const
_packet->gps_satellites = num_gps_sats;
_packet->galileo_satellites = num_gal_sats;
_packet->microseconds = static_cast<uint32_t>(elapsed_seconds.count() * 1.0e6);
_packet->latitude = static_cast<double>(pvt->get_latitude()) * (M_PI / 180.0);
_packet->longitude = static_cast<double>(pvt->get_longitude()) * (M_PI / 180.0);
_packet->height = static_cast<double>(pvt->get_height());
_packet->latitude = pvt->get_latitude() * (M_PI / 180.0);
_packet->longitude = pvt->get_longitude() * (M_PI / 180.0);
_packet->height = pvt->get_height();
_packet->velocity[0] = static_cast<float>(pvt->get_rx_vel()[1]);
_packet->velocity[1] = static_cast<float>(pvt->get_rx_vel()[0]);
_packet->velocity[2] = static_cast<float>(-pvt->get_rx_vel()[2]);
@ -196,11 +196,11 @@ void An_Packet_Printer::update_sdr_gnss_packet(sdr_gnss_packet_t* _packet, const
void An_Packet_Printer::encode_sdr_gnss_packet(sdr_gnss_packet_t* sdr_gnss_packet, an_packet_t* _packet) const
{
uint8_t offset = 0;
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->nsvfix), offset, _packet->data, sizeof(sdr_gnss_packet->nsvfix));
LSB_bytes_to_array(&sdr_gnss_packet->nsvfix, offset, _packet->data, sizeof(sdr_gnss_packet->nsvfix));
offset += sizeof(sdr_gnss_packet->nsvfix);
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->gps_satellites), offset, _packet->data, sizeof(sdr_gnss_packet->gps_satellites));
LSB_bytes_to_array(&sdr_gnss_packet->gps_satellites, offset, _packet->data, sizeof(sdr_gnss_packet->gps_satellites));
offset += sizeof(sdr_gnss_packet->gps_satellites);
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->galileo_satellites), offset, _packet->data, sizeof(sdr_gnss_packet->galileo_satellites));
LSB_bytes_to_array(&sdr_gnss_packet->galileo_satellites, offset, _packet->data, sizeof(sdr_gnss_packet->galileo_satellites));
offset += sizeof(sdr_gnss_packet->galileo_satellites);
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sdr_gnss_packet->microseconds), offset, _packet->data, sizeof(sdr_gnss_packet->microseconds));
offset += sizeof(sdr_gnss_packet->microseconds);
@ -218,9 +218,9 @@ void An_Packet_Printer::encode_sdr_gnss_packet(sdr_gnss_packet_t* sdr_gnss_packe
offset += sizeof(sdr_gnss_packet->velocity[2]);
for (auto& sat : sdr_gnss_packet->sats)
{
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sat.prn), offset, _packet->data, sizeof(sat.prn));
LSB_bytes_to_array(&sat.prn, offset, _packet->data, sizeof(sat.prn));
offset += sizeof(sat.prn);
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sat.snr), offset, _packet->data, sizeof(sat.snr));
LSB_bytes_to_array(&sat.snr, offset, _packet->data, sizeof(sat.snr));
offset += sizeof(sat.snr);
LSB_bytes_to_array(reinterpret_cast<uint8_t*>(&sat.doppler), offset, _packet->data, sizeof(sat.doppler));
offset += sizeof(sat.doppler);

View File

@ -929,7 +929,7 @@ int32_t Rtcm::read_MT1005(const std::string& message, uint32_t& ref_id, double&
const uint32_t reserved_field_length = 6;
uint32_t index = preamble_length + reserved_field_length;
uint32_t read_message_length = static_cast<uint32_t>(Rtcm::bin_to_uint(message_bin.substr(index, 10)));
uint32_t read_message_length = Rtcm::bin_to_uint(message_bin.substr(index, 10));
index += 10;
if (read_message_length != 19)
{
@ -1601,7 +1601,7 @@ int32_t Rtcm::read_MT1019(const std::string& message, Gps_Ephemeris& gps_eph) co
const uint32_t reserved_field_length = 6;
uint32_t index = preamble_length + reserved_field_length;
const uint32_t read_message_length = static_cast<uint32_t>(Rtcm::bin_to_uint(message_bin.substr(index, 10)));
const uint32_t read_message_length = Rtcm::bin_to_uint(message_bin.substr(index, 10));
index += 10;
if (read_message_length != 61)
@ -1621,7 +1621,7 @@ int32_t Rtcm::read_MT1019(const std::string& message, Gps_Ephemeris& gps_eph) co
}
// Fill Gps Ephemeris with message data content
gps_eph.PRN = static_cast<uint32_t>(Rtcm::bin_to_uint(message_bin.substr(index, 6)));
gps_eph.PRN = Rtcm::bin_to_uint(message_bin.substr(index, 6));
index += 6;
gps_eph.WN = static_cast<int32_t>(Rtcm::bin_to_uint(message_bin.substr(index, 10)));
@ -1835,7 +1835,7 @@ int32_t Rtcm::read_MT1020(const std::string& message, Glonass_Gnav_Ephemeris& gl
const uint32_t reserved_field_length = 6;
uint32_t index = preamble_length + reserved_field_length;
const uint32_t read_message_length = static_cast<uint32_t>(Rtcm::bin_to_uint(message_bin.substr(index, 10)));
const uint32_t read_message_length = Rtcm::bin_to_uint(message_bin.substr(index, 10));
index += 10;
if (read_message_length != 45) // 360 bits = 45 bytes
@ -1855,7 +1855,7 @@ int32_t Rtcm::read_MT1020(const std::string& message, Glonass_Gnav_Ephemeris& gl
}
// Fill Gps Ephemeris with message data content
glonass_gnav_eph.i_satellite_slot_number = static_cast<uint32_t>(Rtcm::bin_to_uint(message_bin.substr(index, 6)));
glonass_gnav_eph.i_satellite_slot_number = Rtcm::bin_to_uint(message_bin.substr(index, 6));
index += 6;
glonass_gnav_eph.i_satellite_freq_channel = static_cast<int32_t>(Rtcm::bin_to_uint(message_bin.substr(index, 5)) - 7.0);
@ -2138,7 +2138,7 @@ int32_t Rtcm::read_MT1045(const std::string& message, Galileo_Ephemeris& gal_eph
const uint32_t reserved_field_length = 6;
uint32_t index = preamble_length + reserved_field_length;
const uint32_t read_message_length = static_cast<uint32_t>(Rtcm::bin_to_uint(message_bin.substr(index, 10)));
const uint32_t read_message_length = Rtcm::bin_to_uint(message_bin.substr(index, 10));
index += 10;
if (read_message_length != 62)
@ -2158,7 +2158,7 @@ int32_t Rtcm::read_MT1045(const std::string& message, Galileo_Ephemeris& gal_eph
}
// Fill Galileo Ephemeris with message data content
gal_eph.PRN = static_cast<uint32_t>(Rtcm::bin_to_uint(message_bin.substr(index, 6)));
gal_eph.PRN = Rtcm::bin_to_uint(message_bin.substr(index, 6));
index += 6;
gal_eph.WN = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 12)));
@ -2233,7 +2233,7 @@ int32_t Rtcm::read_MT1045(const std::string& message, Galileo_Ephemeris& gal_eph
gal_eph.BGD_E1E5a = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 10)));
index += 10;
gal_eph.E5a_HS = static_cast<uint32_t>(Rtcm::bin_to_uint(message_bin.substr(index, 2)));
gal_eph.E5a_HS = Rtcm::bin_to_uint(message_bin.substr(index, 2));
index += 2;
gal_eph.E5a_DVS = static_cast<bool>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));

View File

@ -613,15 +613,15 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
{
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1.0F - weighting_factor * static_cast<float>((doppler_index - i)));
}
d_CAF_vector[doppler_index] /= static_cast<float>(1.0F + static_cast<float>(CAF_bins_half + doppler_index) - weighting_factor * static_cast<float>(CAF_bins_half) * ((static_cast<float>(CAF_bins_half) + 1.0F) / 2.0F) - weighting_factor * static_cast<float>(doppler_index) * (static_cast<float>(doppler_index) + 1.0F) / 2.0F); // triangles = [n*(n+1)/2]
d_CAF_vector[doppler_index] /= 1.0F + static_cast<float>(CAF_bins_half + doppler_index) - weighting_factor * static_cast<float>(CAF_bins_half) * ((static_cast<float>(CAF_bins_half) + 1.0F) / 2.0F) - weighting_factor * static_cast<float>(doppler_index) * (static_cast<float>(doppler_index) + 1.0F) / 2.0F; // triangles = [n*(n+1)/2]
if (d_both_signal_components)
{
accum[0] = 0;
for (int i = 0; i < CAF_bins_half + doppler_index + 1; i++)
{
accum[0] += static_cast<float>(d_CAF_vector_Q[i] * (1.0F - weighting_factor * static_cast<float>(abs(doppler_index - i))));
accum[0] += d_CAF_vector_Q[i] * (1.0F - weighting_factor * static_cast<float>(abs(doppler_index - i)));
}
accum[0] /= static_cast<float>(1.0F + static_cast<float>(CAF_bins_half + doppler_index) - weighting_factor * static_cast<float>(CAF_bins_half) * static_cast<float>(CAF_bins_half + 1) / 2.0F - weighting_factor * static_cast<float>(doppler_index) * static_cast<float>(doppler_index + 1) / 2.0F); // triangles = [n*(n+1)/2]
accum[0] /= 1.0F + static_cast<float>(CAF_bins_half + doppler_index) - weighting_factor * static_cast<float>(CAF_bins_half) * static_cast<float>(CAF_bins_half + 1) / 2.0F - weighting_factor * static_cast<float>(doppler_index) * static_cast<float>(doppler_index + 1) / 2.0F; // triangles = [n*(n+1)/2]
d_CAF_vector[doppler_index] += accum[0];
}
}
@ -629,19 +629,19 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
for (int doppler_index = CAF_bins_half; doppler_index < d_num_doppler_bins - CAF_bins_half; doppler_index++)
{
d_CAF_vector[doppler_index] = 0;
for (int i = doppler_index - CAF_bins_half; i < static_cast<int>(doppler_index + CAF_bins_half + 1); i++)
for (int i = doppler_index - CAF_bins_half; i < doppler_index + CAF_bins_half + 1; i++)
{
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1.0F - weighting_factor * static_cast<float>((doppler_index - i)));
}
d_CAF_vector[doppler_index] /= static_cast<float>(1.0F + 2.0F * static_cast<float>(CAF_bins_half) - 2.0F * weighting_factor * static_cast<float>(CAF_bins_half) * static_cast<float>(CAF_bins_half + 1) / 2.0F);
d_CAF_vector[doppler_index] /= 1.0F + 2.0F * static_cast<float>(CAF_bins_half) - 2.0F * weighting_factor * static_cast<float>(CAF_bins_half) * static_cast<float>(CAF_bins_half + 1) / 2.0F;
if (d_both_signal_components)
{
accum[0] = 0;
for (int i = doppler_index - CAF_bins_half; i < static_cast<int>(doppler_index + CAF_bins_half + 1); i++)
for (int i = doppler_index - CAF_bins_half; i < doppler_index + CAF_bins_half + 1; i++)
{
accum[0] += static_cast<float>(d_CAF_vector_Q[i] * (1 - weighting_factor * static_cast<float>((doppler_index - i))));
accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * static_cast<float>((doppler_index - i)));
}
accum[0] /= static_cast<float>(1.0F + 2.0F * static_cast<float>(CAF_bins_half) - 2.0F * weighting_factor * static_cast<float>(CAF_bins_half) * static_cast<float>(CAF_bins_half + 1) / 2.0F);
accum[0] /= 1.0F + 2.0F * static_cast<float>(CAF_bins_half) - 2.0F * weighting_factor * static_cast<float>(CAF_bins_half) * static_cast<float>(CAF_bins_half + 1) / 2.0F;
d_CAF_vector[doppler_index] += accum[0];
}
}
@ -653,13 +653,13 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
{
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1.0F - weighting_factor * static_cast<float>(abs(doppler_index - i)));
}
d_CAF_vector[doppler_index] /= static_cast<float>(1.0F + static_cast<float>(CAF_bins_half) + static_cast<float>(d_num_doppler_bins - doppler_index - 1) - weighting_factor * static_cast<float>(CAF_bins_half) * (static_cast<float>(CAF_bins_half) + 1.0F) / 2.0F - weighting_factor * static_cast<float>(d_num_doppler_bins - doppler_index - 1) * static_cast<float>(d_num_doppler_bins - doppler_index) / 2.0F);
d_CAF_vector[doppler_index] /= 1.0F + static_cast<float>(CAF_bins_half) + static_cast<float>(d_num_doppler_bins - doppler_index - 1) - weighting_factor * static_cast<float>(CAF_bins_half) * (static_cast<float>(CAF_bins_half) + 1.0F) / 2.0F - weighting_factor * (d_num_doppler_bins - doppler_index - 1) * static_cast<float>(d_num_doppler_bins - doppler_index) / 2.0F;
if (d_both_signal_components)
{
accum[0] = 0;
for (int i = doppler_index - CAF_bins_half; i < static_cast<int>(d_num_doppler_bins); i++)
{
accum[0] += static_cast<float>(d_CAF_vector_Q[i] * (1.0F - weighting_factor * static_cast<float>(abs(doppler_index - i))));
accum[0] += d_CAF_vector_Q[i] * (1.0F - weighting_factor * static_cast<float>(abs(doppler_index - i)));
}
accum[0] /= static_cast<float>(1.0F + static_cast<float>(CAF_bins_half) + static_cast<float>(d_num_doppler_bins - doppler_index - 1) - weighting_factor * static_cast<float>(CAF_bins_half) * static_cast<float>(CAF_bins_half + 1.0) / 2.0 - weighting_factor * static_cast<float>(d_num_doppler_bins - doppler_index - 1) * static_cast<float>(d_num_doppler_bins - doppler_index) / 2.0);
d_CAF_vector[doppler_index] += accum[0];

View File

@ -258,7 +258,7 @@ void pcps_acquisition::init()
d_mag = 0.0;
d_input_power = 0.0;
d_num_doppler_bins = static_cast<uint32_t>(std::ceil(static_cast<double>(static_cast<int32_t>(d_acq_parameters.doppler_max) - static_cast<int32_t>(-d_acq_parameters.doppler_max)) / static_cast<double>(d_doppler_step)));
d_num_doppler_bins = static_cast<uint32_t>(std::ceil(static_cast<double>(2 * d_acq_parameters.doppler_max) / static_cast<double>(d_doppler_step)));
// Create the carrier Doppler wipeoff signals
if (d_grid_doppler_wipeoffs.empty())

View File

@ -1584,11 +1584,11 @@ void time2epoch(gtime_t t, double *ep)
break;
}
}
ep[0] = 1970 + static_cast<int>(days / 1461) * 4 + static_cast<int>(mon / 12);
ep[0] = 1970 + days / 1461 * 4 + mon / 12;
ep[1] = mon % 12 + 1;
ep[2] = day + 1;
ep[3] = static_cast<int>(sec / 3600);
ep[4] = static_cast<int>(sec % 3600 / 60);
ep[3] = sec / 3600;
ep[4] = sec % 3600 / 60;
ep[5] = sec % 60 + t.sec;
}

View File

@ -383,7 +383,7 @@ size_t FileSourceBase::samplesToSkip() const
size_t FileSourceBase::computeSamplesInFile() const
{
auto n_samples = static_cast<size_t>(samples());
auto n_samples = samples();
// this could throw, but the existence of the file has been proven before we get here.
const auto size = fs::file_size(filename());

View File

@ -69,7 +69,7 @@ FourBitCpxFileSignalSource::FourBitCpxFileSignalSource(
std::tuple<size_t, bool> FourBitCpxFileSignalSource::itemTypeToSize()
{
auto is_complex = false;
auto item_size = size_t(sizeof(char)); // default
auto item_size = sizeof(char); // default
if (item_type() == "byte")
{

View File

@ -40,7 +40,7 @@ NsrFileSignalSource::NsrFileSignalSource(const ConfigurationInterface* configura
std::tuple<size_t, bool> NsrFileSignalSource::itemTypeToSize()
{
auto is_complex = false;
auto item_size = size_t(sizeof(char)); // default
auto item_size = sizeof(char); // default
if (item_type() == "byte")
{

View File

@ -43,7 +43,7 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(
std::tuple<size_t, bool> TwoBitCpxFileSignalSource::itemTypeToSize()
{
auto is_complex = false;
auto item_size = size_t(sizeof(char)); // default
auto item_size = sizeof(char); // default
if (item_type() == "byte")
{

View File

@ -49,7 +49,7 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(
std::tuple<size_t, bool> TwoBitPackedFileSignalSource::itemTypeToSize()
{
auto is_complex_t = false;
auto item_size = size_t(sizeof(char)); // default
auto item_size = sizeof(char); // default
if (item_type() == "byte")
{

View File

@ -43,7 +43,7 @@ ZmqSignalSource::ZmqSignalSource(const ConfigurationInterface* configuration,
{
LOG(INFO) << "Connecting to ZMQ pub at " << endpoint;
// work around gnuradio interface const-deficiency
d_source_block = gr::zeromq::sub_source::make(d_item_size, vlen, const_cast<char*>(endpoint.data()), timeout_ms, pass_tags, hwm);
d_source_block = gr::zeromq::sub_source::make(d_item_size, vlen, endpoint.data(), timeout_ms, pass_tags, hwm);
// work around another bug. GNU Radio passes tags through the ZMQ block
// unconditionally if pass_tags is true, but that flag controls protocol more

View File

@ -1100,7 +1100,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
{
// TOW_5 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_inav_nav.get_TOW5() * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms;
d_inav_nav.set_TOW5_flag(false);
if (d_there_are_e6_channels && !d_valid_timetag)
{
@ -1111,7 +1111,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
// timetag debug
if (d_valid_timetag == true)
{
int decoder_delay_ms = static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms);
int decoder_delay_ms = GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms;
int rx_tow_at_preamble = d_current_timetag.tow_ms - decoder_delay_ms;
if (rx_tow_at_preamble < 0)
{
@ -1126,7 +1126,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
{
// TOW_6 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_inav_nav.get_TOW6() * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms;
d_inav_nav.set_TOW6_flag(false);
if (d_there_are_e6_channels && !d_valid_timetag)
{
@ -1137,7 +1137,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
// timetag debug
if (d_valid_timetag == true)
{
int decoder_delay_ms = static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms);
int decoder_delay_ms = GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms;
int rx_tow_at_preamble = d_current_timetag.tow_ms - decoder_delay_ms;
if (rx_tow_at_preamble < 0)
{
@ -1151,7 +1151,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
{
// TOW_0 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_inav_nav.get_TOW0() * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms;
d_inav_nav.set_TOW0_flag(false);
if (d_there_are_e6_channels && !d_valid_timetag)
{
@ -1162,7 +1162,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
// timetag debug
if (d_valid_timetag == true)
{
int decoder_delay_ms = static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms);
int decoder_delay_ms = GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms;
int rx_tow_at_preamble = d_current_timetag.tow_ms - decoder_delay_ms;
if (rx_tow_at_preamble < 0)
{
@ -1195,7 +1195,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
if (d_fnav_nav.is_TOW1_set() == true)
{
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_fnav_nav.get_TOW1() * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS;
d_fnav_nav.set_TOW1_flag(false);
if (d_there_are_e6_channels && !d_valid_timetag)
{
@ -1207,7 +1207,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
else if (d_fnav_nav.is_TOW2_set() == true)
{
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_fnav_nav.get_TOW2() * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS;
d_fnav_nav.set_TOW2_flag(false);
if (d_there_are_e6_channels && !d_valid_timetag)
{
@ -1219,7 +1219,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
else if (d_fnav_nav.is_TOW3_set() == true)
{
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_fnav_nav.get_TOW3() * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS;
d_fnav_nav.set_TOW3_flag(false);
if (d_there_are_e6_channels && !d_valid_timetag)
{
@ -1231,7 +1231,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
else if (d_fnav_nav.is_TOW4_set() == true)
{
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_fnav_nav.get_TOW4() * 1000.0);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS);
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS;
d_fnav_nav.set_TOW4_flag(false);
if (d_there_are_e6_channels && !d_valid_timetag)
{
@ -1262,7 +1262,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
int rx_tow_at_preamble = d_current_timetag.tow_ms;
uint32_t predicted_tow_at_preamble_ms = 1000 * (rx_tow_at_preamble / 1000); // floor to integer number of seconds
d_TOW_at_Preamble_ms = predicted_tow_at_preamble_ms;
d_TOW_at_current_symbol_ms = predicted_tow_at_preamble_ms + static_cast<uint32_t>((d_required_symbols + 1) * d_PRN_code_period_ms);
d_TOW_at_current_symbol_ms = predicted_tow_at_preamble_ms + (d_required_symbols + 1) * d_PRN_code_period_ms;
if (d_E6_TOW_set == false)
{
std::cout << " Sat PRN " << d_satellite.get_PRN() << " E6 TimeTag TOW at preamble: " << predicted_tow_at_preamble_ms

View File

@ -54,7 +54,7 @@ double fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2, double
{
const float dot = prompt_s1.real() * prompt_s2.real() + prompt_s1.imag() * prompt_s2.imag();
const float cross = prompt_s1.real() * prompt_s2.imag() - prompt_s2.real() * prompt_s1.imag();
return static_cast<double>(gr::fast_atan2f(cross, dot) / (t2 - t1));
return gr::fast_atan2f(cross, dot) / (t2 - t1);
}
@ -85,7 +85,7 @@ double fll_diff_atan(gr_complex prompt_s1, gr_complex prompt_s2, double t1, doub
*/
double pll_four_quadrant_atan(gr_complex prompt_s1)
{
return static_cast<double>(gr::fast_atan2f(prompt_s1.imag(), prompt_s1.real()));
return gr::fast_atan2f(prompt_s1.imag(), prompt_s1.real());
}

View File

@ -492,7 +492,7 @@ int32_t Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& s
d_eccentricity_msb = static_cast<double>(read_navigation_unsigned(subframe_bits, D2_E_MSB));
d_eccentricity_msb_bits = (read_navigation_unsigned(subframe_bits, D2_E_MSB));
// Adjust for lsb in next page (shift number of lsb to the left)
d_eccentricity_msb = static_cast<uint64_t>((static_cast<uint64_t>(d_eccentricity_msb) << 22U));
d_eccentricity_msb = static_cast<uint64_t>(d_eccentricity_msb) << 22U;
d_eccentricity_msb_bits = d_eccentricity_msb_bits << 22U;
// Set system flags for message reception

View File

@ -60,7 +60,7 @@ bool Galileo_Fnav_Message::CRC_test(const std::bitset<GALILEO_FNAV_DATA_FRAME_BI
// using boost::dynamic_bitset.
// ToDo: Use boost::dynamic_bitset for all the bitset operations in this class
boost::dynamic_bitset<uint8_t> frame_bits(std::string(bits.to_string()));
boost::dynamic_bitset<uint8_t> frame_bits(bits.to_string());
std::vector<uint8_t> bytes;
boost::to_block_range(frame_bits, std::back_inserter(bytes));

View File

@ -54,7 +54,7 @@ bool Galileo_Inav_Message::CRC_test(const std::bitset<GALILEO_DATA_FRAME_BITS>&
// using boost::dynamic_bitset.
// ToDo: Use boost::dynamic_bitset for all the bitset operations in this class
boost::dynamic_bitset<unsigned char> frame_bits(std::string(bits.to_string()));
boost::dynamic_bitset<unsigned char> frame_bits(bits.to_string());
std::vector<unsigned char> bytes;
boost::to_block_range(frame_bits, std::back_inserter(bytes));
@ -162,7 +162,7 @@ int64_t Galileo_Inav_Message::read_navigation_signed(const std::bitset<GALILEO_D
bool Galileo_Inav_Message::read_navigation_bool(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{
bool value;
if (static_cast<int>(static_cast<int>(bits[GALILEO_DATA_JK_BITS - parameter[0].first])) == 1)
if (static_cast<int>(bits[GALILEO_DATA_JK_BITS - parameter[0].first]) == 1)
{
value = true;
}
@ -989,15 +989,15 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk)
ai2_5 = ai2_5 * AI2_5_LSB;
DLOG(INFO) << "ai2_5= " << ai2_5;
// Ionospheric disturbance flag
Region1_flag_5 = static_cast<bool>(read_navigation_bool(data_jk_bits, REGION1_5_BIT));
Region1_flag_5 = read_navigation_bool(data_jk_bits, REGION1_5_BIT);
DLOG(INFO) << "Region1_flag_5= " << Region1_flag_5;
Region2_flag_5 = static_cast<bool>(read_navigation_bool(data_jk_bits, REGION2_5_BIT));
Region2_flag_5 = read_navigation_bool(data_jk_bits, REGION2_5_BIT);
DLOG(INFO) << "Region2_flag_5= " << Region2_flag_5;
Region3_flag_5 = static_cast<bool>(read_navigation_bool(data_jk_bits, REGION3_5_BIT));
Region3_flag_5 = read_navigation_bool(data_jk_bits, REGION3_5_BIT);
DLOG(INFO) << "Region3_flag_5= " << Region3_flag_5;
Region4_flag_5 = static_cast<bool>(read_navigation_bool(data_jk_bits, REGION4_5_BIT));
Region4_flag_5 = read_navigation_bool(data_jk_bits, REGION4_5_BIT);
DLOG(INFO) << "Region4_flag_5= " << Region4_flag_5;
Region5_flag_5 = static_cast<bool>(read_navigation_bool(data_jk_bits, REGION5_5_BIT));
Region5_flag_5 = read_navigation_bool(data_jk_bits, REGION5_5_BIT);
DLOG(INFO) << "Region5_flag_5= " << Region5_flag_5;
BGD_E1E5a_5 = static_cast<double>(read_navigation_signed(data_jk_bits, BGD_E1_E5A_5_BIT));
BGD_E1E5a_5 = BGD_E1E5a_5 * BGD_E1_E5A_5_LSB;

View File

@ -292,7 +292,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
if (flag_ephemeris_str_1 == true)
{
gnav_ephemeris.d_B_n = static_cast<double>(read_navigation_unsigned(string_bits, B_N));
gnav_ephemeris.d_P_2 = static_cast<bool>(read_navigation_bool(string_bits, P2));
gnav_ephemeris.d_P_2 = read_navigation_bool(string_bits, P2);
gnav_ephemeris.d_t_b = static_cast<double>(read_navigation_unsigned(string_bits, T_B)) * 15 * 60;
gnav_ephemeris.d_VYn = static_cast<double>(read_navigation_signed(string_bits, Y_N_DOT)) * TWO_N20;
gnav_ephemeris.d_AYn = static_cast<double>(read_navigation_signed(string_bits, Y_N_DOT_DOT)) * TWO_N30;
@ -308,10 +308,10 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
// --- It is string 3 ----------------------------------------------
if (flag_ephemeris_str_2 == true)
{
gnav_ephemeris.d_P_3 = static_cast<bool>(read_navigation_bool(string_bits, P3));
gnav_ephemeris.d_P_3 = read_navigation_bool(string_bits, P3);
gnav_ephemeris.d_gamma_n = static_cast<double>(read_navigation_signed(string_bits, GAMMA_N)) * TWO_N40;
gnav_ephemeris.d_P = static_cast<double>(read_navigation_unsigned(string_bits, P));
gnav_ephemeris.d_l3rd_n = static_cast<bool>(read_navigation_bool(string_bits, EPH_L_N));
gnav_ephemeris.d_l3rd_n = read_navigation_bool(string_bits, EPH_L_N);
gnav_ephemeris.d_VZn = static_cast<double>(read_navigation_signed(string_bits, Z_N_DOT)) * TWO_N20;
gnav_ephemeris.d_AZn = static_cast<double>(read_navigation_signed(string_bits, Z_N_DOT_DOT)) * TWO_N30;
gnav_ephemeris.d_Zn = static_cast<double>(read_navigation_signed(string_bits, Z_N)) * TWO_N11;
@ -328,7 +328,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
gnav_ephemeris.d_tau_n = static_cast<double>(read_navigation_signed(string_bits, TAU_N)) * TWO_N30;
gnav_ephemeris.d_Delta_tau_n = static_cast<double>(read_navigation_signed(string_bits, DELTA_TAU_N)) * TWO_N30;
gnav_ephemeris.d_E_n = static_cast<double>(read_navigation_unsigned(string_bits, E_N));
gnav_ephemeris.d_P_4 = static_cast<bool>(read_navigation_bool(string_bits, P4));
gnav_ephemeris.d_P_4 = read_navigation_bool(string_bits, P4);
gnav_ephemeris.d_F_T = static_cast<double>(read_navigation_unsigned(string_bits, F_T));
gnav_ephemeris.d_N_T = static_cast<double>(read_navigation_unsigned(string_bits, N_T));
gnav_ephemeris.d_n = static_cast<double>(read_navigation_unsigned(string_bits, N));
@ -352,7 +352,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
gnav_utc_model.d_tau_c = static_cast<double>(read_navigation_signed(string_bits, TAU_C)) * TWO_N31;
gnav_utc_model.d_N_4 = static_cast<double>(read_navigation_unsigned(string_bits, N_4));
gnav_utc_model.d_tau_gps = static_cast<double>(read_navigation_signed(string_bits, TAU_GPS)) * TWO_N30;
gnav_ephemeris.d_l5th_n = static_cast<bool>(read_navigation_bool(string_bits, ALM_L_N));
gnav_ephemeris.d_l5th_n = read_navigation_bool(string_bits, ALM_L_N);
flag_utc_model_str_5 = true;
@ -402,7 +402,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
return 0;
}
gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N));
gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = read_navigation_bool(string_bits, C_N);
gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_tau_n_A = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N_A)) * TWO_N18;
@ -423,7 +423,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_N_A)) * TWO_N9;
gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * TWO_N14;
gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A = static_cast<double>(read_navigation_unsigned(string_bits, H_N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = static_cast<bool>(read_navigation_bool(string_bits, ALM_L_N));
gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = read_navigation_bool(string_bits, ALM_L_N);
// Set satellite information for redundancy purposes
if (gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A > 24)
@ -452,7 +452,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
return 0;
}
gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N));
gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = read_navigation_bool(string_bits, C_N);
gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_tau_n_A = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N_A)) * TWO_N18;
@ -473,7 +473,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_N_A)) * TWO_N9;
gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * TWO_N14;
gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A = static_cast<double>(read_navigation_unsigned(string_bits, H_N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = static_cast<bool>(read_navigation_bool(string_bits, ALM_L_N));
gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = read_navigation_bool(string_bits, ALM_L_N);
// Set satellite information for redundancy purposes
if (gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A > 24)
@ -497,7 +497,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
return 0;
}
gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N));
gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = read_navigation_bool(string_bits, C_N);
gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_tau_n_A = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N_A)) * TWO_N18;
@ -518,7 +518,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_N_A)) * TWO_N9;
gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * TWO_N14;
gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A = static_cast<double>(read_navigation_unsigned(string_bits, H_N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = static_cast<bool>(read_navigation_bool(string_bits, ALM_L_N));
gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = read_navigation_bool(string_bits, ALM_L_N);
// Set satellite information for redundancy purposes
if (gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A > 24)
@ -541,7 +541,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
{
return 0;
}
gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N));
gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = read_navigation_bool(string_bits, C_N);
gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_tau_n_A = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N_A)) * TWO_N18;
@ -562,7 +562,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_N_A)) * TWO_N9;
gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * TWO_N14;
gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A = static_cast<double>(read_navigation_unsigned(string_bits, H_N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = static_cast<bool>(read_navigation_bool(string_bits, ALM_L_N));
gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = read_navigation_bool(string_bits, ALM_L_N);
// Set satellite information for redundancy purposes
if (gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A > 24)
@ -592,7 +592,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
{
return 0;
}
gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N));
gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = read_navigation_bool(string_bits, C_N);
gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_n_A = static_cast<double>(read_navigation_unsigned(string_bits, N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_tau_n_A = static_cast<double>(read_navigation_unsigned(string_bits, TAU_N_A)) * TWO_N18;
@ -613,7 +613,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_N_A)) * TWO_N9;
gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast<double>(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * TWO_N14;
gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A = static_cast<double>(read_navigation_unsigned(string_bits, H_N_A));
gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = static_cast<bool>(read_navigation_bool(string_bits, ALM_L_N));
gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = read_navigation_bool(string_bits, ALM_L_N);
// Set satellite information for redundancy purposes
if (gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A > 24)

View File

@ -113,7 +113,7 @@ void Gps_CNAV_Navigation_Message::decode_page(const std::bitset<GPS_CNAV_DATA_PA
d_TOW *= CNAV_TOW_LSB;
ephemeris_record.tow = d_TOW;
alert_flag = static_cast<bool>(read_navigation_bool(data_bits, CNAV_ALERT_FLAG));
alert_flag = read_navigation_bool(data_bits, CNAV_ALERT_FLAG);
ephemeris_record.alert_flag = alert_flag;
page_type = static_cast<int32_t>(read_navigation_unsigned(data_bits, CNAV_MSG_TYPE));
@ -145,8 +145,8 @@ void Gps_CNAV_Navigation_Message::decode_page(const std::bitset<GPS_CNAV_DATA_PA
ephemeris_record.omega = static_cast<double>(read_navigation_signed(data_bits, CNAV_OMEGA));
ephemeris_record.omega *= CNAV_OMEGA_LSB;
ephemeris_record.integrity_status_flag = static_cast<bool>(read_navigation_bool(data_bits, CNAV_INTEGRITY_FLAG));
ephemeris_record.l2c_phasing_flag = static_cast<bool>(read_navigation_bool(data_bits, CNAV_L2_PHASING_FLAG));
ephemeris_record.integrity_status_flag = read_navigation_bool(data_bits, CNAV_INTEGRITY_FLAG);
ephemeris_record.l2c_phasing_flag = read_navigation_bool(data_bits, CNAV_L2_PHASING_FLAG);
b_flag_ephemeris_1 = true;
break;