PDA

View Full Version : Tests Sound SEE not compile on Linux



daltomi
12-10-2013, 11:18 PM
Hi.
The test Tests/Sound/SSE not compile on Linux, is not just a warning.
File test.app line 130:


float dummy;
in_float_buffer1[cnt] = modf(( float (random_number)) / 13.223f, &dummy);
in_float_buffer2[cnt] = modf(( float (random_number)) / 53.321f, &dummy);


The func. modf is for double not float.


SYNOPSIS
#include <math.h>

double modf(double x, double *iptr);
float modff(float x, float *iptr);
long double modfl(long double x, long double *iptr);


I ended up choosing modff.



ClanLib Test Suite:
-------------------
Target: LINUX
For clanSound SSE functions
All Tests Complete

Regards

rombust
12-11-2013, 07:19 AM
C++98 says:


double modf (double x , double* intpart);
float modf (float x , float* intpart);
long double modf (long double x, long double* intpart);


According to http://www.cplusplus.com/reference/cmath/modf/

Maybe we are not using the correct header file (#include <cmath> vs <math.h> vs <math>)

daltomi
12-11-2013, 04:11 PM
If you're right.
I propose the following:
The project is compiled with the standard "-std=c++0x".
Standard say for cmath:

The contents of these headers are the same as the Standard C library headers <math.h> and <stdlib.h>
respectively, with the following changes:
8 - In addition to the double versions of the math functions in <cmath>, C++ adds float and long double
overloaded versions of these functions, with the same semantics.


Then I force the compiler to use the standard library.


std::modf(...):

rombust
12-12-2013, 08:25 AM
That's good.

Applied Patch

Many Thanks.