1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-02-07 14:40:12 +00:00

Fix redundant comparison

Use std::llabs instead of abs
This commit is contained in:
Carles Fernandez 2020-03-16 11:51:50 +01:00
parent 6da98e3381
commit b8f5da341b
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 9 additions and 10 deletions

View File

@ -176,7 +176,7 @@ int gps_l2c_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
// check if new CNAV frame is available // check if new CNAV frame is available
if (flag_new_cnav_frame == true) if (flag_new_cnav_frame == true)
{ {
if (d_cnav_decoder.part1.invert == true or d_cnav_decoder.part1.invert == true) if (d_cnav_decoder.part1.invert == true or d_cnav_decoder.part2.invert == true)
{ {
flag_PLL_180_deg_phase_locked = true; flag_PLL_180_deg_phase_locked = true;
} }
@ -235,7 +235,6 @@ int gps_l2c_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
} }
} }
if (flag_PLL_180_deg_phase_locked == true) if (flag_PLL_180_deg_phase_locked == true)
{ {
// correct the accumulated phase for the Costas loop phase shift, if required // correct the accumulated phase for the Costas loop phase shift, if required

View File

@ -28,10 +28,10 @@
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <pmt/pmt.h> // for make_any #include <pmt/pmt.h> // for make_any
#include <pmt/pmt_sugar.h> // for mp #include <pmt/pmt_sugar.h> // for mp
#include <bitset> #include <bitset> // for std::bitset
#include <cstdlib> // for abs #include <cstdlib> // for std::llabs
#include <exception> // for exception #include <exception> // for std::exception
#include <iostream> #include <iostream> // for std::cout
#include <memory> // for shared_ptr, make_shared #include <memory> // for shared_ptr, make_shared
@ -168,7 +168,7 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u
// check if new CNAV frame is available // check if new CNAV frame is available
if (cnav_msg_decoder_add_symbol(&d_cnav_decoder, symbol_clip, &msg, &delay) == true) if (cnav_msg_decoder_add_symbol(&d_cnav_decoder, symbol_clip, &msg, &delay) == true)
{ {
if (d_cnav_decoder.part1.invert == true or d_cnav_decoder.part1.invert == true) if (d_cnav_decoder.part1.invert == true or d_cnav_decoder.part2.invert == true)
{ {
flag_PLL_180_deg_phase_locked = true; flag_PLL_180_deg_phase_locked = true;
} }
@ -218,10 +218,10 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u
// check TOW update consistency // check TOW update consistency
uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms; uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
d_TOW_at_current_symbol_ms = msg.tow * 6000 + (delay + 12) * GPS_L5I_SYMBOL_PERIOD_MS; d_TOW_at_current_symbol_ms = msg.tow * 6000 + (delay + 12) * GPS_L5I_SYMBOL_PERIOD_MS;
if (last_d_TOW_at_current_symbol_ms != 0 and abs(static_cast<int64_t>(d_TOW_at_current_symbol_ms) - int64_t(last_d_TOW_at_current_symbol_ms)) > GPS_L5I_SYMBOL_PERIOD_MS) if (last_d_TOW_at_current_symbol_ms != 0 and std::llabs(static_cast<int64_t>(d_TOW_at_current_symbol_ms) - static_cast<int64_t>(last_d_TOW_at_current_symbol_ms)) > static_cast<int64_t>(GPS_L5I_SYMBOL_PERIOD_MS))
{ {
DLOG(INFO) << "Warning: GPS L5 TOW update in ch " << d_channel DLOG(INFO) << "Warning: GPS L5 TOW update in ch " << d_channel
<< " does not match the TLM TOW counter " << static_cast<int64_t>(d_TOW_at_current_symbol_ms) - int64_t(last_d_TOW_at_current_symbol_ms) << " ms " << " does not match the TLM TOW counter " << static_cast<int64_t>(d_TOW_at_current_symbol_ms) - static_cast<int64_t>(last_d_TOW_at_current_symbol_ms) << " ms "
<< " with delay: " << delay << " msg tow: " << msg.tow * 6000 << " ms \n"; << " with delay: " << delay << " msg tow: " << msg.tow * 6000 << " ms \n";
d_TOW_at_current_symbol_ms = 0; d_TOW_at_current_symbol_ms = 0;