1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-10-31 15:23:04 +00:00

Fix low-impact performance inefficiency defects detected by Coverity Scan 2024.6

Reduce defect noise so other defects are easier spotted
This commit is contained in:
Carles Fernandez
2025-01-23 22:32:35 +01:00
parent 274fdfd6b7
commit bd0d19a24b
55 changed files with 173 additions and 148 deletions

View File

@@ -21,6 +21,7 @@
#include <cmath>
#include <functional>
#include <numeric>
#include <utility>
#include <vector>
double Gnss_Almanac::check_t(double time) const
@@ -72,12 +73,12 @@ double Gnss_Almanac::predicted_doppler(double rx_time_s,
const std::vector<double> pos_sat = {sat_pos_vel[0], sat_pos_vel[1], sat_pos_vel[2]};
const std::vector<double> vel_sat = {sat_pos_vel[3], sat_pos_vel[4], sat_pos_vel[5]};
std::vector<double> x_sr = pos_sat;
std::vector<double> x_sr = std::move(pos_sat);
std::transform(x_sr.begin(), x_sr.end(), pos_rx.begin(), x_sr.begin(), std::minus<double>()); // pos_sat - pos_rx
const double norm_x_sr = std::sqrt(std::inner_product(x_sr.begin(), x_sr.end(), x_sr.begin(), 0.0)); // Euclidean norm
std::vector<double> v_sr = vel_sat;
std::vector<double> v_sr = std::move(vel_sat);
std::transform(v_sr.begin(), v_sr.end(), vel_rx.begin(), v_sr.begin(), std::minus<double>()); // vel_sat - vel_rx
const double radial_vel = std::inner_product(v_sr.begin(), v_sr.end(), x_sr.begin(), 0.0) / norm_x_sr;

View File

@@ -22,6 +22,7 @@
#include <cmath>
#include <functional>
#include <numeric>
#include <utility>
#include <vector>
@@ -68,12 +69,12 @@ double Gnss_Ephemeris::predicted_doppler(double rx_time_s,
const std::vector<double> pos_sat = {sat_pos_vel[0], sat_pos_vel[1], sat_pos_vel[2]};
const std::vector<double> vel_sat = {sat_pos_vel[3], sat_pos_vel[4], sat_pos_vel[5]};
std::vector<double> x_sr = pos_sat;
std::vector<double> x_sr = std::move(pos_sat);
std::transform(x_sr.begin(), x_sr.end(), pos_rx.begin(), x_sr.begin(), std::minus<double>()); // pos_sat - pos_rx
const double norm_x_sr = std::sqrt(std::inner_product(x_sr.begin(), x_sr.end(), x_sr.begin(), 0.0)); // Euclidean norm
std::vector<double> v_sr = vel_sat;
std::vector<double> v_sr = std::move(vel_sat);
std::transform(v_sr.begin(), v_sr.end(), vel_rx.begin(), v_sr.begin(), std::minus<double>()); // vel_sat - vel_rx
const double radial_vel = std::inner_product(v_sr.begin(), v_sr.end(), x_sr.begin(), 0.0) / norm_x_sr;

View File

@@ -202,7 +202,7 @@ private:
int32_t i_Toa{}; // Almanac reference time [s]
int32_t i_WN_A{}; // Modulo 256 of the GPS week number to which the almanac reference time (i_Toa) is referenced
int32_t SV_Health{}; // Almanac SV healt
uint32_t a_PRN; // Almanac PRN
uint32_t a_PRN{}; // Almanac PRN
double a_delta_i{}; // Inclination Angle at Reference Time (relative to i_0 = 0.30 semi-circles)
double a_M_0{}; // Mean Anomaly at Reference Time [semi-circles]
double a_ecc{}; // Eccentricity [dimensionless]