1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +00:00

Replace memset by std::fill_n. This fix warnings in GCC 8.0.1 (Fedora

Rawhide). The warnings were:

 warning: 'void* memset(void*, int, size_t)' clearing an object of
non-trivial type 'struct std::complex<float>'; use assignment or
value-initialization instead [-Wclass-memaccess]
This commit is contained in:
Carles Fernandez 2018-02-25 13:27:27 +01:00
parent 9e37e51447
commit 946d3dae9f
4 changed files with 11 additions and 11 deletions

View File

@ -31,7 +31,7 @@
*/
#include "pcps_acquisition_fine_doppler_cc.h"
#include <algorithm> // std::rotate
#include <algorithm> // std::rotate, std::fill_n
#include <sstream>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
@ -331,7 +331,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star
gr::fft::fft_complex *fft_operator = new gr::fft::fft_complex(fft_size_extended, true);
//zero padding the entire vector
memset(fft_operator->get_inbuf(), 0, fft_size_extended * sizeof(gr_complex));
std::fill_n(fft_operator->get_inbuf(), fft_size_extended, gr_complex(0.0, 0.0));
//1. generate local code aligned with the acquisition code phase estimation
gr_complex *code_replica = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));

View File

@ -29,7 +29,7 @@
* -------------------------------------------------------------------------
*/
#include <algorithm>
#include <chrono>
#include <complex>
#include <armadillo>
@ -44,7 +44,7 @@ TEST(ConjugateTest, StandardCComplexImplementation)
{
std::complex<float>* input = new std::complex<float>[FLAGS_size_conjugate_test];
std::complex<float>* output = new std::complex<float>[FLAGS_size_conjugate_test];
memset(input, 0, sizeof(std::complex<float>) * FLAGS_size_conjugate_test);
std::fill_n(input, FLAGS_size_conjugate_test, std::complex<float>(0.0, 0.0));
std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now();
@ -118,7 +118,7 @@ TEST(ConjugateTest, VolkComplexImplementation)
{
std::complex<float>* input = static_cast<std::complex<float>*>(volk_gnsssdr_malloc(FLAGS_size_conjugate_test * sizeof(std::complex<float>), volk_gnsssdr_get_alignment()));
std::complex<float>* output = static_cast<std::complex<float>*>(volk_gnsssdr_malloc(FLAGS_size_conjugate_test * sizeof(std::complex<float>), volk_gnsssdr_get_alignment()));
memset(input, 0, sizeof(std::complex<float>) * FLAGS_size_conjugate_test);
std::fill_n(input, FLAGS_size_conjugate_test, std::complex<float>(0.0, 0.0));
std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now();

View File

@ -30,7 +30,7 @@
* -------------------------------------------------------------------------
*/
#include <algorithm>
#include <chrono>
#include <complex>
#include <armadillo>
@ -115,7 +115,7 @@ TEST(MagnitudeSquaredTest, ArmadilloComplexImplementation)
TEST(MagnitudeSquaredTest, VolkComplexImplementation)
{
std::complex<float>* input = static_cast<std::complex<float>*>(volk_gnsssdr_malloc(FLAGS_size_magnitude_test * sizeof(std::complex<float>), volk_gnsssdr_get_alignment()));
memset(input, 0, sizeof(std::complex<float>) * FLAGS_size_magnitude_test);
std::fill_n(input, FLAGS_size_magnitude_test, std::complex<float>(0.0, 0.0));
float* output = static_cast<float*>(volk_gnsssdr_malloc(FLAGS_size_magnitude_test * sizeof(float), volk_gnsssdr_get_alignment()));
std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now();

View File

@ -30,7 +30,7 @@
* -------------------------------------------------------------------------
*/
#include <algorithm>
#include <chrono>
#include <complex>
#include <numeric>
@ -45,7 +45,7 @@ TEST(MultiplyTest, StandardCDoubleImplementation)
{
double* input = new double[FLAGS_size_multiply_test];
double* output = new double[FLAGS_size_multiply_test];
memset(input, 0, sizeof(double) * FLAGS_size_multiply_test);
std::fill_n(input, FLAGS_size_multiply_test, 0.0);
std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now();
@ -98,7 +98,7 @@ TEST(MultiplyTest, StandardCComplexImplementation)
{
std::complex<float>* input = new std::complex<float>[FLAGS_size_multiply_test];
std::complex<float>* output = new std::complex<float>[FLAGS_size_multiply_test];
memset(input, 0, sizeof(std::complex<float>) * FLAGS_size_multiply_test);
std::fill_n(input, FLAGS_size_multiply_test, std::complex<float>(0.0, 0.0));
std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now();
@ -180,7 +180,7 @@ TEST(MultiplyTest, VolkComplexImplementation)
{
std::complex<float>* input = static_cast<std::complex<float>*>(volk_gnsssdr_malloc(FLAGS_size_multiply_test * sizeof(std::complex<float>), volk_gnsssdr_get_alignment()));
std::complex<float>* output = static_cast<std::complex<float>*>(volk_gnsssdr_malloc(FLAGS_size_multiply_test * sizeof(std::complex<float>), volk_gnsssdr_get_alignment()));
memset(input, 0, sizeof(std::complex<float>) * FLAGS_size_multiply_test);
std::fill_n(input, FLAGS_size_multiply_test, std::complex<float>(0.0, 0.0));
std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now();