mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-28 09:54:51 +00:00
Fixing memory problem in Magnitude square test
This commit is contained in:
parent
496f2139c3
commit
de91bf6b23
@ -42,8 +42,6 @@ DEFINE_int32(size_magnitude_test, 100000, "Size of the arrays used for magnitude
|
||||
TEST(MagnitudeSquared_Test, StandardCComplexImplementation)
|
||||
{
|
||||
std::complex<float>* input = new std::complex<float>[FLAGS_size_magnitude_test];
|
||||
memset(input, 0, sizeof(std::complex<float>) * FLAGS_size_magnitude_test);
|
||||
const float* inputPtr = (float*)input;
|
||||
float* output = new float[FLAGS_size_magnitude_test];
|
||||
unsigned int number = 0;
|
||||
struct timeval tv;
|
||||
@ -52,9 +50,7 @@ TEST(MagnitudeSquared_Test, StandardCComplexImplementation)
|
||||
|
||||
for(number = 0; number < (unsigned int)FLAGS_size_magnitude_test; number++)
|
||||
{
|
||||
const float real = *inputPtr++;
|
||||
const float imag = *inputPtr++;
|
||||
*output++ = (real*real) + (imag*imag);
|
||||
output[number] = (input[number].real()*input[number].real()) + (input[number].imag()*input[number].imag());
|
||||
}
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user