1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 04:00:34 +00:00

Replace C-style casts by C++-style casts

This commit is contained in:
Carles Fernandez 2017-10-16 20:35:06 +02:00
parent 8ef49734db
commit 66a585bfeb

View File

@ -59,7 +59,7 @@ pulse_blanking_cc::pulse_blanking_cc(float pfa, int length_, int n_segments_est,
this->n_segments_est = n_segments_est; this->n_segments_est = n_segments_est;
this->n_segments_reset = n_segments_reset; this->n_segments_reset = n_segments_reset;
noise_power_estimation = 0.0; noise_power_estimation = 0.0;
n_deg_fred = 2*length_; n_deg_fred = 2 * length_;
boost::math::chi_squared_distribution<float> my_dist_(n_deg_fred); boost::math::chi_squared_distribution<float> my_dist_(n_deg_fred);
thres_ = boost::math::quantile(boost::math::complement(my_dist_, pfa)); thres_ = boost::math::quantile(boost::math::complement(my_dist_, pfa));
zeros_ = static_cast<gr_complex *>(volk_malloc(length_ * sizeof(gr_complex), volk_get_alignment())); zeros_ = static_cast<gr_complex *>(volk_malloc(length_ * sizeof(gr_complex), volk_get_alignment()));
@ -90,19 +90,19 @@ int pulse_blanking_cc::general_work (int noutput_items __attribute__((unused)),
volk_32f_accumulator_s32f(&segment_energy, (magnitude + sample_index), length_); volk_32f_accumulator_s32f(&segment_energy, (magnitude + sample_index), length_);
if((n_segments < n_segments_est) && (last_filtered == false)) if((n_segments < n_segments_est) && (last_filtered == false))
{ {
noise_power_estimation = (((float) n_segments) * noise_power_estimation + segment_energy / ((float)n_deg_fred)) / ((float)(n_segments + 1)); noise_power_estimation = ( static_cast<float>(n_segments) * noise_power_estimation + segment_energy / static_cast<float>(n_deg_fred) ) / static_cast<float>(n_segments + 1);
memcpy(out, in, sizeof(gr_complex)*length_); memcpy(out, in, sizeof(gr_complex) * length_);
} }
else else
{ {
if((segment_energy/noise_power_estimation) > thres_) if((segment_energy / noise_power_estimation) > thres_)
{ {
memcpy(out, zeros_, sizeof(gr_complex)*length_); memcpy(out, zeros_, sizeof(gr_complex) * length_);
last_filtered = true; last_filtered = true;
} }
else else
{ {
memcpy(out, in, sizeof(gr_complex)*length_); memcpy(out, in, sizeof(gr_complex) * length_);
last_filtered = false; last_filtered = false;
if (n_segments > n_segments_reset) if (n_segments > n_segments_reset)
{ {
@ -110,9 +110,9 @@ int pulse_blanking_cc::general_work (int noutput_items __attribute__((unused)),
} }
} }
} }
in+=length_; in += length_;
out+=length_; out += length_;
sample_index+=length_; sample_index += length_;
n_segments++; n_segments++;
} }
volk_free(magnitude); volk_free(magnitude);