From e8fb655fad81249704af6b0505548a296f078216 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 13 Jun 2022 21:05:29 +0200 Subject: [PATCH 1/2] Fixes binary on ArchLinux (Fixes: #616) Replace some memcpy by std:::copy or std::copy_n --- ...o_e5a_noncoherent_iq_acquisition_caf_cc.cc | 9 ++++---- .../galileo_pcps_8ms_acquisition_cc.cc | 3 ++- .../gnuradio_blocks/pcps_acquisition.cc | 23 +++++++++---------- .../pcps_acquisition_fine_doppler_cc.cc | 13 ++++++----- .../pcps_assisted_acquisition_cc.cc | 3 ++- .../pcps_cccwsr_acquisition_cc.cc | 9 ++++---- .../pcps_opencl_acquisition_cc.cc | 6 ++--- .../pcps_quicksync_acquisition_cc.cc | 11 ++++----- .../pcps_tong_acquisition_cc.cc | 3 ++- .../input_filter/gnuradio_blocks/notch_cc.cc | 7 +++--- .../gnuradio_blocks/notch_lite_cc.cc | 7 +++--- .../gnuradio_blocks/pulse_blanking_cc.cc | 6 ++--- .../adapters/beidou_b1i_dll_pll_tracking.cc | 3 ++- .../adapters/beidou_b3i_dll_pll_tracking.cc | 3 ++- .../galileo_e1_dll_pll_veml_tracking.cc | 3 ++- .../galileo_e1_dll_pll_veml_tracking_fpga.cc | 3 ++- .../adapters/galileo_e5a_dll_pll_tracking.cc | 3 ++- .../galileo_e5a_dll_pll_tracking_fpga.cc | 3 ++- .../adapters/galileo_e5b_dll_pll_tracking.cc | 3 ++- .../adapters/galileo_e6_dll_pll_tracking.cc | 3 ++- .../adapters/gps_l1_ca_dll_pll_tracking.cc | 3 ++- .../gps_l1_ca_dll_pll_tracking_fpga.cc | 3 ++- .../adapters/gps_l1_ca_kf_vtl_tracking.cc | 3 ++- .../adapters/gps_l2_m_dll_pll_tracking.cc | 3 ++- .../gps_l2_m_dll_pll_tracking_fpga.cc | 6 ++--- .../adapters/gps_l5_dll_pll_tracking.cc | 3 ++- .../adapters/gps_l5_dll_pll_tracking_fpga.cc | 3 ++- .../unit-tests/arithmetic/fft_speed_test.cc | 3 ++- 28 files changed, 84 insertions(+), 67 deletions(-) diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc index 6c0909d34..69430cca8 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -160,7 +161,7 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::set_local_code(std::complexget_inbuf(), codeI, sizeof(gr_complex) * d_fft_size); + std::copy(codeI, codeI + d_fft_size, d_fft_if->get_inbuf()); d_fft_if->execute(); // We need the FFT of local code @@ -171,7 +172,7 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::set_local_code(std::complexget_inbuf(), codeQ, sizeof(gr_complex) * d_fft_size); + std::copy(codeQ, codeQ + d_fft_size, d_fft_if->get_inbuf()); d_fft_if->execute(); // We need the FFT of local code @@ -336,7 +337,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items { buff_increment = d_fft_size - d_buffer_count; } - memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex) * buff_increment); + std::copy(in, in + buff_increment, d_inbuffer.begin() + d_buffer_count); // If buffer will be full in next iteration if (d_buffer_count >= static_cast(d_fft_size - d_gr_stream_buffer)) { @@ -353,7 +354,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items const auto *in = reinterpret_cast(input_items[0]); // Get the input samples pointer if (d_buffer_count < d_fft_size) { - memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex) * (d_fft_size - d_buffer_count)); + std::copy(in, in + (d_fft_size - d_buffer_count), d_inbuffer.begin() + d_buffer_count); } d_sample_counter += static_cast(d_fft_size - d_buffer_count); // sample counter diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc index b534f30f9..e123424d6 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -115,7 +116,7 @@ galileo_pcps_8ms_acquisition_cc::~galileo_pcps_8ms_acquisition_cc() void galileo_pcps_8ms_acquisition_cc::set_local_code(std::complex *code) { // code A: two replicas of a primary code - memcpy(d_fft_if->get_inbuf(), code, sizeof(gr_complex) * d_fft_size); + std::copy(code, code + d_fft_size, d_fft_if->get_inbuf()); d_fft_if->execute(); // We need the FFT of local code diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index 53dba2af7..872382f4f 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -33,10 +33,9 @@ #include // for mp #include #include -#include // for fill_n, min +#include // for std::fill_n, std::min, std::copy #include -#include // for floor, fmod, rint, ceil -#include // for memcpy +#include // for floor, fmod, rint, ceil #include #include @@ -189,18 +188,18 @@ void pcps_acquisition::set_local_code(std::complex* code) { const int32_t offset = d_fft_size / 2; std::fill_n(d_fft_if->get_inbuf(), offset, gr_complex(0.0, 0.0)); - memcpy(d_fft_if->get_inbuf() + offset, code, sizeof(gr_complex) * offset); + std::copy(code, code + offset, d_fft_if->get_inbuf() + offset); } else { if (d_acq_parameters.sampled_ms == d_acq_parameters.ms_per_code) { - memcpy(d_fft_if->get_inbuf(), code, sizeof(gr_complex) * d_consumed_samples); + std::copy(code, code + d_consumed_samples, d_fft_if->get_inbuf()); } else { std::fill_n(d_fft_if->get_inbuf(), d_fft_size - d_consumed_samples, gr_complex(0.0, 0.0)); - memcpy(d_fft_if->get_inbuf() + d_consumed_samples, code, sizeof(gr_complex) * d_consumed_samples); + std::copy(code, code + d_consumed_samples, d_fft_if->get_inbuf() + d_consumed_samples); } } @@ -577,7 +576,7 @@ float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int32_t } int32_t idx = excludeRangeIndex1; - memcpy(d_tmp_buffer.data(), d_magnitude_grid[index_doppler].data(), d_fft_size * sizeof(float)); + std::copy(d_magnitude_grid[index_doppler].data(), d_magnitude_grid[index_doppler].data() + d_fft_size, d_tmp_buffer.data()); do { d_tmp_buffer[idx] = 0.0; @@ -610,7 +609,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count) { volk_gnsssdr_16ic_convert_32fc(d_data_buffer.data(), d_data_buffer_sc.data(), d_consumed_samples); } - memcpy(d_input_signal.data(), d_data_buffer.data(), d_consumed_samples * sizeof(gr_complex)); + std::copy(d_data_buffer.data(), d_data_buffer.data() + d_consumed_samples, d_input_signal.data()); if (d_fft_size > d_consumed_samples) { for (uint32_t i = d_consumed_samples; i < d_fft_size; i++) @@ -667,7 +666,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count) // Record results to file if required if (d_dump and d_channel == d_dump_channel) { - memcpy(d_grid.colptr(doppler_index), d_magnitude_grid[doppler_index].data(), sizeof(float) * effective_fft_size); + std::copy(d_magnitude_grid[doppler_index].data(), d_magnitude_grid[doppler_index].data() + effective_fft_size, d_grid.colptr(doppler_index)); } } @@ -725,7 +724,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count) // Record results to file if required if (d_dump and d_channel == d_dump_channel) { - memcpy(d_narrow_grid.colptr(doppler_index), d_magnitude_grid[doppler_index].data(), sizeof(float) * effective_fft_size); + std::copy(d_magnitude_grid[doppler_index].data(), d_magnitude_grid[doppler_index].data() + effective_fft_size, d_narrow_grid.colptr(doppler_index)); } } // Compute the test statistic @@ -958,7 +957,7 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)), { buff_increment = d_consumed_samples - d_buffer_count; } - memcpy(&d_data_buffer_sc[d_buffer_count], in, sizeof(lv_16sc_t) * buff_increment); + std::copy(in, in + buff_increment, d_data_buffer_sc.begin() + d_buffer_count); } else { @@ -971,7 +970,7 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)), { buff_increment = d_consumed_samples - d_buffer_count; } - memcpy(&d_data_buffer[d_buffer_count], in, sizeof(gr_complex) * buff_increment); + std::copy(in, in + buff_increment, d_data_buffer.begin() + d_buffer_count); } // If buffer will be full in next iteration diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc index 0b2d0d885..a1941a060 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc @@ -146,7 +146,7 @@ void pcps_acquisition_fine_doppler_cc::set_doppler_step(unsigned int doppler_ste void pcps_acquisition_fine_doppler_cc::set_local_code(std::complex *code) { - memcpy(d_fft_if->get_inbuf(), code, sizeof(gr_complex) * d_fft_size); + std::copy(code, code + d_fft_size, d_fft_if->get_inbuf()); d_fft_if->execute(); // We need the FFT of local code // Conjugate the local code volk_32fc_conjugate_32fc(d_fft_codes.data(), d_fft_if->get_outbuf(), d_fft_size); @@ -234,7 +234,7 @@ float pcps_acquisition_fine_doppler_cc::compute_CAF() // Record results to file if required if (d_dump and d_channel == d_dump_channel) { - memcpy(grid_.colptr(i), d_grid_data[i].data(), sizeof(float) * d_fft_size); + std::copy(d_grid_data[i].data(), d_grid_data[i].data() + d_fft_size, grid_.colptr(i)); } } @@ -372,7 +372,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler() for (int n = 0; n < prn_replicas - 1; n++) { - memcpy(&code_replica[(n + 1) * d_fft_size], code_replica.data(), d_fft_size * sizeof(gr_complex)); + std::copy_n(code_replica.data(), d_fft_size, &code_replica[(n + 1) * d_fft_size]); } // 2. Perform code wipe-off volk_32fc_x2_multiply_32fc(fft_operator->get_inbuf(), d_10_ms_buffer.data(), code_replica.data(), signal_samples); @@ -473,6 +473,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, int return_value = 0; // Number of Gnss_Syncro objects produced int samples_remaining; + const auto *in_aux = reinterpret_cast(input_items[0]); switch (d_state) { case 0: // S0. StandBy @@ -490,7 +491,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, break; case 1: // S1. ComputeGrid compute_and_accumulate_grid(input_items); - memcpy(&d_10_ms_buffer[d_n_samples_in_buffer], reinterpret_cast(input_items[0]), d_fft_size * sizeof(gr_complex)); + std::copy(in_aux, in_aux + d_fft_size, &d_10_ms_buffer[d_n_samples_in_buffer]); d_n_samples_in_buffer += d_fft_size; d_well_count++; if (d_well_count >= d_max_dwells) @@ -518,7 +519,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, if (samples_remaining > noutput_items) { - memcpy(&d_10_ms_buffer[d_n_samples_in_buffer], reinterpret_cast(input_items[0]), noutput_items * sizeof(gr_complex)); + std::copy(in_aux, in_aux + noutput_items, &d_10_ms_buffer[d_n_samples_in_buffer]); d_n_samples_in_buffer += noutput_items; d_sample_counter += static_cast(noutput_items); // sample counter consume_each(noutput_items); @@ -527,7 +528,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, { if (samples_remaining > 0) { - memcpy(&d_10_ms_buffer[d_n_samples_in_buffer], reinterpret_cast(input_items[0]), samples_remaining * sizeof(gr_complex)); + std::copy(in_aux, in_aux + samples_remaining, &d_10_ms_buffer[d_n_samples_in_buffer]); d_sample_counter += static_cast(samples_remaining); // sample counter consume_each(samples_remaining); } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc index 81d168365..56f4b56b3 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -117,7 +118,7 @@ pcps_assisted_acquisition_cc::~pcps_assisted_acquisition_cc() void pcps_assisted_acquisition_cc::set_local_code(std::complex *code) { - memcpy(d_fft_if->get_inbuf(), code, sizeof(gr_complex) * d_fft_size); + std::copy(code, code + d_fft_size, d_fft_if->get_inbuf()); } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc index 47905fab9..2d58d0758 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -126,7 +127,7 @@ void pcps_cccwsr_acquisition_cc::set_local_code(std::complex *code_data, std::complex *code_pilot) { // Data code (E1B) - memcpy(d_fft_if->get_inbuf(), code_data, sizeof(gr_complex) * d_fft_size); + std::copy(code_data, code_data + d_fft_size, d_fft_if->get_inbuf()); d_fft_if->execute(); // We need the FFT of local code @@ -134,7 +135,7 @@ void pcps_cccwsr_acquisition_cc::set_local_code(std::complex *code_data, volk_32fc_conjugate_32fc(d_fft_code_data.data(), d_fft_if->get_outbuf(), d_fft_size); // Pilot code (E1C) - memcpy(d_fft_if->get_inbuf(), code_pilot, sizeof(gr_complex) * d_fft_size); + std::copy(code_pilot, code_pilot + d_fft_size, d_fft_if->get_inbuf()); d_fft_if->execute(); // We need the FFT of local code @@ -284,7 +285,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items, // Copy the result of the correlation between wiped--off signal and data code in // d_data_correlation. - memcpy(d_data_correlation.data(), d_ifft->get_outbuf(), sizeof(gr_complex) * d_fft_size); + std::copy(d_ifft->get_outbuf(), d_ifft->get_outbuf() + d_fft_size, d_data_correlation.data()); // Multiply carrier wiped--off, Fourier transformed incoming signal // with the local FFT'd pilot code reference (E1C) using SIMD operations @@ -297,7 +298,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items, // Copy the result of the correlation between wiped--off signal and pilot code in // d_data_correlation. - memcpy(d_pilot_correlation.data(), d_ifft->get_outbuf(), sizeof(gr_complex) * d_fft_size); + std::copy(d_ifft->get_outbuf(), d_ifft->get_outbuf() + d_fft_size, d_pilot_correlation.data()); for (uint32_t i = 0; i < d_fft_size; i++) { diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc index b55015d6a..0d364bdd6 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc @@ -330,7 +330,7 @@ void pcps_opencl_acquisition_cc::set_local_code(std::complex *code) } else { - memcpy(d_fft_if->get_inbuf(), code, sizeof(gr_complex) * d_fft_size); + std::copy(code, code + d_fft_size, d_fft_if->get_inbuf()); d_fft_if->execute(); // We need the FFT of local code @@ -695,8 +695,8 @@ int pcps_opencl_acquisition_cc::general_work(int noutput_items, uint32_t num_dwells = std::min(static_cast(d_max_dwells - d_in_dwell_count), ninput_items[0]); for (uint32_t i = 0; i < num_dwells; i++) { - memcpy(d_in_buffer[d_in_dwell_count++].data(), static_cast(input_items[i]), - sizeof(gr_complex) * d_fft_size); + const auto *in = reinterpret_cast(input_items[i]); + std::copy(in, in + d_fft_size, d_in_buffer[d_in_dwell_count++].data()); d_sample_counter += static_cast(d_fft_size); d_sample_counter_buffer.push_back(d_sample_counter); } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc index 5576a3f63..44dcb4c73 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc @@ -136,9 +136,9 @@ void pcps_quicksync_acquisition_cc::set_local_code(std::complex* code) { /* save a local copy of the code without the folding process to perform corre- lation in time in the final steps of the acquisition stage */ - memcpy(d_code.data(), code, sizeof(gr_complex) * d_samples_per_code); + std::copy(code, code + d_samples_per_code, d_code.data()); - memcpy(d_fft_if->get_inbuf(), d_code_folded.data(), sizeof(gr_complex) * (d_fft_size)); + std::copy(d_code_folded.data(), d_code_folded.data() + d_fft_size, d_fft_if->get_inbuf()); /* perform folding of the code by the factorial factor parameter. Notice that folding of the code in the time stage would result in a downsampled spectrum @@ -317,7 +317,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items, // at zero. This is done to avoid over acumulation when performing // the folding process to be stored in d_fft_if->get_inbuf() d_signal_folded = std::vector(d_fft_size, lv_cmake(0.0F, 0.0F)); - memcpy(d_fft_if->get_inbuf(), d_signal_folded.data(), sizeof(gr_complex) * (d_fft_size)); + std::copy(d_signal_folded.data(), d_signal_folded.data() + d_fft_size, d_fft_if->get_inbuf()); // Doppler search steps and then multiplication of the incoming // signal with the doppler wipeoffs to eliminate frequency offset @@ -392,9 +392,8 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items, for (int32_t i = 0; i < static_cast(d_folding_factor); i++) { // Copy a signal of 1 code length into suggested buffer. - // The copied signal must have doppler effect corrected*/ - memcpy(in_1code.data(), &in_temp[d_possible_delay[i]], - sizeof(gr_complex) * (d_samples_per_code)); + // The copied signal must have doppler effect corrected + std::copy_n(&in_temp[d_possible_delay[i]], d_samples_per_code, in_1code.data()); // Perform multiplication of the unmodified local // generated code with the incoming signal with doppler diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc index 720bdf917..9563f3af6 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -140,7 +141,7 @@ pcps_tong_acquisition_cc::~pcps_tong_acquisition_cc() void pcps_tong_acquisition_cc::set_local_code(std::complex *code) { - memcpy(d_fft_if->get_inbuf(), code, sizeof(gr_complex) * d_fft_size); + std::copy(code, code + d_fft_size, d_fft_if->get_inbuf()); d_fft_if->execute(); // We need the FFT of local code diff --git a/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc b/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc index 09c651cd8..8a4982b1b 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc +++ b/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc @@ -20,7 +20,6 @@ #include #include #include -#include notch_sptr make_notch_filter(float pfa, float p_c_factor, @@ -75,13 +74,13 @@ int Notch::general_work(int noutput_items, gr_vector_int &ninput_items __attribu { if ((n_segments_ < n_segments_est_) && (filter_state_ == false)) { - memcpy(d_fft_->get_inbuf(), in, sizeof(gr_complex) * length_); + std::copy(in, in + length_, d_fft_->get_inbuf()); d_fft_->execute(); volk_32fc_s32f_power_spectrum_32f(power_spect_.data(), d_fft_->get_outbuf(), 1.0, length_); volk_32f_s32f_calc_spectral_noise_floor_32f(&sig2dB, power_spect_.data(), 15.0, length_); sig2lin = std::pow(10.0F, (sig2dB / 10.0F)) / (static_cast(n_deg_fred_)); noise_pow_est_ = (static_cast(n_segments_) * noise_pow_est_ + sig2lin) / (static_cast(n_segments_ + 1)); - memcpy(out, in, sizeof(gr_complex) * length_); + std::copy(in, in + length_, out); } else { @@ -109,7 +108,7 @@ int Notch::general_work(int noutput_items, gr_vector_int &ninput_items __attribu n_segments_ = 0; } filter_state_ = false; - memcpy(out, in, sizeof(gr_complex) * length_); + std::copy(in, in + length_, out); } } index_out += length_; diff --git a/src/algorithms/input_filter/gnuradio_blocks/notch_lite_cc.cc b/src/algorithms/input_filter/gnuradio_blocks/notch_lite_cc.cc index c0902d724..67ce8a480 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/notch_lite_cc.cc +++ b/src/algorithms/input_filter/gnuradio_blocks/notch_lite_cc.cc @@ -21,7 +21,6 @@ #include #include #include -#include notch_lite_sptr make_notch_filter_lite(float p_c_factor, float pfa, int32_t length, int32_t n_segments_est, int32_t n_segments_reset, int32_t n_segments_coeff) @@ -83,13 +82,13 @@ int NotchLite::general_work(int noutput_items, gr_vector_int &ninput_items __att { if ((n_segments_ < n_segments_est_) && (filter_state_ == false)) { - memcpy(d_fft_->get_inbuf(), in, sizeof(gr_complex) * length_); + std::copy(in, in + length_, d_fft_->get_inbuf()); d_fft_->execute(); volk_32fc_s32f_power_spectrum_32f(power_spect_.data(), d_fft_->get_outbuf(), 1.0, length_); volk_32f_s32f_calc_spectral_noise_floor_32f(&sig2dB, power_spect_.data(), 15.0, length_); sig2lin = std::pow(10.0F, (sig2dB / 10.0F)) / static_cast(n_deg_fred_); noise_pow_est_ = (static_cast(n_segments_) * noise_pow_est_ + sig2lin) / static_cast(n_segments_ + 1); - memcpy(out, in, sizeof(gr_complex) * length_); + std::copy(in, in + length_, out); } else { @@ -126,7 +125,7 @@ int NotchLite::general_work(int noutput_items, gr_vector_int &ninput_items __att n_segments_ = 0; } filter_state_ = false; - memcpy(out, in, sizeof(gr_complex) * length_); + std::copy(in, in + length_, out); } } index_out += length_; diff --git a/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc b/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc index d963f0b2b..f639385dd 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc +++ b/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc @@ -69,18 +69,18 @@ int pulse_blanking_cc::general_work(int noutput_items, gr_vector_int &ninput_ite if ((n_segments_ < n_segments_est_) && (last_filtered_ == false)) { noise_power_estimation_ = (static_cast(n_segments_) * noise_power_estimation_ + segment_energy / static_cast(n_deg_fred_)) / static_cast(n_segments_ + 1); - memcpy(out, in, sizeof(gr_complex) * length_); + std::copy(in, in + length_, out); } else { if ((segment_energy / noise_power_estimation_) > thres_) { - memcpy(out, zeros_.data(), sizeof(gr_complex) * length_); + std::copy_n(zeros_.data(), length_, out); last_filtered_ = true; } else { - memcpy(out, in, sizeof(gr_complex) * length_); + std::copy(in, in + length_, out); last_filtered_ = false; if (n_segments_ > n_segments_reset_) { diff --git a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc index ec7b2b503..8c87751dc 100644 --- a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc @@ -27,6 +27,7 @@ #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" #include +#include #include @@ -62,7 +63,7 @@ BeidouB1iDllPllTracking::BeidouB1iDllPllTracking( } trk_params.system = 'C'; const std::array sig_{'B', '1', '\0'}; - std::memcpy(trk_params.signal, sig_.data(), 3); + std::copy_n(sig_.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ if (trk_params.item_type == "gr_complex") diff --git a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc index b1b4958d5..09bfd34f5 100644 --- a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc @@ -27,6 +27,7 @@ #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" #include +#include #include BeidouB3iDllPllTracking::BeidouB3iDllPllTracking( @@ -52,7 +53,7 @@ BeidouB3iDllPllTracking::BeidouB3iDllPllTracking( } trk_params.system = 'C'; const std::array sig_{'B', '3', '\0'}; - std::memcpy(trk_params.signal, sig_.data(), 3); + std::copy_n(sig_.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ if (trk_params.item_type == "gr_complex") diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc index d77519495..9c104f9ad 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc @@ -27,6 +27,7 @@ #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" #include +#include #include GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( @@ -55,7 +56,7 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( trk_params.vector_length = vector_length; trk_params.system = 'E'; const std::array sig_{'1', 'B', '\0'}; - std::memcpy(trk_params.signal, sig_.data(), 3); + std::copy_n(sig_.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ if (trk_params.item_type == "gr_complex") diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc index abab7dfc4..d718ad50d 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc @@ -30,6 +30,7 @@ #include "uio_fpga.h" #include #include +#include #include GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( @@ -59,7 +60,7 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( trk_params_fpga.vector_length = vector_length; trk_params_fpga.system = 'E'; const std::array sig_{'1', 'B', '\0'}; - std::memcpy(trk_params_fpga.signal, sig_.data(), 3); + std::copy_n(sig_.data(), 3, trk_params_fpga.signal); // UIO device file device_name = configuration->property(role + ".devicename", default_device_name_Galileo_E1); diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc index b954a800a..5a9efcc7b 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc @@ -27,6 +27,7 @@ #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" #include +#include #include GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( @@ -55,7 +56,7 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( } trk_params.system = 'E'; const std::array sig_{'5', 'X', '\0'}; - std::memcpy(trk_params.signal, sig_.data(), 3); + std::copy_n(sig_.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ if (trk_params.item_type == "gr_complex") diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc index e547fc880..fd87bb6cf 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc @@ -25,6 +25,7 @@ #include "uio_fpga.h" #include #include +#include #include GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( @@ -54,7 +55,7 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( } trk_params_fpga.system = 'E'; const std::array sig_{'5', 'X', '\0'}; - std::memcpy(trk_params_fpga.signal, sig_.data(), 3); + std::copy_n(sig_.data(), 3, trk_params.signal); d_data_codes = nullptr; diff --git a/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc index a77999ff1..1d4e53be8 100644 --- a/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc @@ -28,6 +28,7 @@ #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" #include +#include #include GalileoE5bDllPllTracking::GalileoE5bDllPllTracking( @@ -56,7 +57,7 @@ GalileoE5bDllPllTracking::GalileoE5bDllPllTracking( } trk_params.system = 'E'; const std::array sig_{'7', 'X', '\0'}; - std::memcpy(trk_params.signal, sig_.data(), 3); + std::copy_n(sig_.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ if (trk_params.item_type == "gr_complex") diff --git a/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc index d123ca2d3..267a33ce4 100644 --- a/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc @@ -23,6 +23,7 @@ #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" #include +#include #include GalileoE6DllPllTracking::GalileoE6DllPllTracking( @@ -51,7 +52,7 @@ GalileoE6DllPllTracking::GalileoE6DllPllTracking( } trk_params.system = 'E'; const std::array sig_{'E', '6', '\0'}; - std::memcpy(trk_params.signal, sig_.data(), 3); + std::copy_n(sig_.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ if (trk_params.item_type == "gr_complex") diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc index 7c35a1e3c..bb901f9d5 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc @@ -28,6 +28,7 @@ #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" #include +#include #include GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( @@ -63,7 +64,7 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( trk_params.system = 'G'; const std::array sig_{'1', 'C', '\0'}; - std::memcpy(trk_params.signal, sig_.data(), 3); + std::copy_n(sig_.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ if (trk_params.item_type == "gr_complex") diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc index b606a4a86..bf47f5a0e 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc @@ -30,6 +30,7 @@ #include "uio_fpga.h" #include #include +#include #include GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( @@ -64,7 +65,7 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( } trk_params_fpga.system = 'G'; const std::array sig_{'1', 'C', '\0'}; - std::memcpy(trk_params_fpga.signal, sig_.data(), 3); + std::copy_n(sig_.data(), 3, trk_params.signal); // UIO device file device_name = configuration->property(role + ".devicename", default_device_name_GPS_L1); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_kf_vtl_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_kf_vtl_tracking.cc index b0a3c3b85..7c28c1b07 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_kf_vtl_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_kf_vtl_tracking.cc @@ -27,6 +27,7 @@ #include "gnss_sdr_flags.h" #include "kf_conf.h" #include +#include #include GpsL1CaKfVtlTracking::GpsL1CaKfVtlTracking( @@ -58,7 +59,7 @@ GpsL1CaKfVtlTracking::GpsL1CaKfVtlTracking( trk_params.system = 'G'; const std::array sig_{'1', 'C', '\0'}; - std::memcpy(trk_params.signal, sig_.data(), 3); + std::copy_n(sig_.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ if (trk_params.item_type == "gr_complex") diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc index 9c1b5aadd..1df69625b 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc @@ -27,6 +27,7 @@ #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" #include +#include #include GpsL2MDllPllTracking::GpsL2MDllPllTracking( @@ -52,7 +53,7 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking( } trk_params.system = 'G'; const std::array sig_{'2', 'S', '\0'}; - std::memcpy(trk_params.signal, sig_.data(), 3); + std::copy_n(sig_.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ if (trk_params.item_type == "gr_complex") diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc index e8b0007cd..b7c430d48 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc @@ -32,9 +32,9 @@ #include "uio_fpga.h" #include #include +#include #include -#include // for round -#include // for memcpy +#include // for round #include GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( @@ -62,7 +62,7 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( } trk_params_fpga.system = 'G'; const std::array sig_{'2', 'S', '\0'}; - std::memcpy(trk_params_fpga.signal, sig_.data(), 3); + std::copy_n(sig_.data(), 3, trk_params.signal); // UIO device file device_name = configuration->property(role + ".devicename", default_device_name_GPS_L2); diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc index bea9b5b25..31896d6b7 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc @@ -27,6 +27,7 @@ #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" #include +#include #include GpsL5DllPllTracking::GpsL5DllPllTracking( @@ -55,7 +56,7 @@ GpsL5DllPllTracking::GpsL5DllPllTracking( } trk_params.system = 'G'; const std::array sig_{'L', '5', '\0'}; - std::memcpy(trk_params.signal, sig_.data(), 3); + std::copy_n(sig_.data(), 3, trk_params.signal); // ################# Make a GNU Radio Tracking block object ################ if (trk_params.item_type == "gr_complex") diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc index 5d5824dd0..f201a6460 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc @@ -32,6 +32,7 @@ #include "uio_fpga.h" #include #include +#include #include GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( @@ -61,7 +62,7 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( d_track_pilot = trk_params_fpga.track_pilot; trk_params_fpga.system = 'G'; const std::array sig_{'L', '5', '\0'}; - std::memcpy(trk_params_fpga.signal, sig_.data(), 3); + std::copy_n(sig_.data(), 3, trk_params.signal); // UIO device file device_name = configuration->property(role + ".devicename", default_device_name_GPS_L5); diff --git a/src/tests/unit-tests/arithmetic/fft_speed_test.cc b/src/tests/unit-tests/arithmetic/fft_speed_test.cc index eca130d21..2fa477b81 100644 --- a/src/tests/unit-tests/arithmetic/fft_speed_test.cc +++ b/src/tests/unit-tests/arithmetic/fft_speed_test.cc @@ -18,6 +18,7 @@ #include "gnss_sdr_fft.h" #include +#include #include #include @@ -39,7 +40,7 @@ TEST(FFTSpeedTest, ArmadilloVSGNURadioExecutionTime) arma::arma_rng::set_seed_random(); arma::cx_fvec d_arma_fft = arma::cx_fvec(d_fft_size).randn() + gr_complex(0.0, 1.0) * arma::cx_fvec(d_fft_size).randn(); arma::cx_fvec d_arma_fft_result(d_fft_size); - memcpy(d_gr_fft->get_inbuf(), d_arma_fft.memptr(), sizeof(gr_complex) * d_fft_size); + std::copy_n(d_arma_fft.memptr(), d_fft_size, d_gr_fft->get_inbuf()); start = std::chrono::system_clock::now(); for (int k = 0; k < FLAGS_fft_speed_iterations_test; k++) From cc50da14252c7c34403242b5f0dd11322b441f7e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 14 Jun 2022 09:31:35 +0200 Subject: [PATCH 2/2] Fix std::copy usage, replace more memcpy by std::copy --- .../tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc | 2 +- .../tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc | 2 +- .../tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc | 2 +- .../tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc | 2 +- .../gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc | 2 +- .../gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc | 3 ++- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc index fd87bb6cf..1f5c26140 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc @@ -55,7 +55,7 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( } trk_params_fpga.system = 'E'; const std::array sig_{'5', 'X', '\0'}; - std::copy_n(sig_.data(), 3, trk_params.signal); + std::copy_n(sig_.data(), 3, trk_params_fpga.signal); d_data_codes = nullptr; diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc index bf47f5a0e..105bbe482 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc @@ -65,7 +65,7 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( } trk_params_fpga.system = 'G'; const std::array sig_{'1', 'C', '\0'}; - std::copy_n(sig_.data(), 3, trk_params.signal); + std::copy_n(sig_.data(), 3, trk_params_fpga.signal); // UIO device file device_name = configuration->property(role + ".devicename", default_device_name_GPS_L1); diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc index b7c430d48..b252e44de 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc @@ -62,7 +62,7 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( } trk_params_fpga.system = 'G'; const std::array sig_{'2', 'S', '\0'}; - std::copy_n(sig_.data(), 3, trk_params.signal); + std::copy_n(sig_.data(), 3, trk_params_fpga.signal); // UIO device file device_name = configuration->property(role + ".devicename", default_device_name_GPS_L2); diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc index f201a6460..a3695aaa1 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc @@ -62,7 +62,7 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( d_track_pilot = trk_params_fpga.track_pilot; trk_params_fpga.system = 'G'; const std::array sig_{'L', '5', '\0'}; - std::copy_n(sig_.data(), 3, trk_params.signal); + std::copy_n(sig_.data(), 3, trk_params_fpga.signal); // UIO device file device_name = configuration->property(role + ".devicename", default_device_name_GPS_L5); diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc index 7f6262d58..16c554fc4 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc @@ -156,7 +156,7 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking() d_acq_carrier_doppler_hz = static_cast(d_acquisition_gnss_synchro->Acq_doppler_hz); d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; std::array Signal_{}; - std::memcpy(Signal_.data(), d_acquisition_gnss_synchro->Signal, 3); + std::copy_n(d_acquisition_gnss_synchro->Signal, 3, Signal_.data()); // generate local reference ALWAYS starting at chip 1 (2 samples per chip) galileo_e1_code_gen_complex_sampled(d_ca_code, diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc index 45d274b9f..3714f072e 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -349,7 +350,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribut // ################# CARRIER WIPEOFF AND CORRELATORS ############################## // perform carrier wipe-off and compute Early, Prompt and Late correlation - memcpy(in_gpu, in, sizeof(gr_complex) * d_correlation_length_samples); + std::copy(in, in + d_correlation_length_samples, in_gpu); cudaProfilerStart(); multicorrelator_gpu->Carrier_wipeoff_multicorrelator_resampler_cuda(static_cast(d_rem_carrier_phase_rad), static_cast(d_carrier_phase_step_rad),