Check for and use copysignf
This commit is contained in:
parent
529f387695
commit
21dc2c761d
@ -536,6 +536,7 @@ CHECK_SYMBOL_EXISTS(lrintf math.h HAVE_LRINTF)
|
||||
CHECK_SYMBOL_EXISTS(modff math.h HAVE_MODFF)
|
||||
CHECK_SYMBOL_EXISTS(log2f math.h HAVE_LOG2F)
|
||||
CHECK_SYMBOL_EXISTS(cbrtf math.h HAVE_CBRTF)
|
||||
CHECK_SYMBOL_EXISTS(copysignf math.h HAVE_COPYSIGNF)
|
||||
|
||||
IF(HAVE_FLOAT_H)
|
||||
CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP)
|
||||
|
@ -484,7 +484,7 @@ inline void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread,
|
||||
*/
|
||||
inline float ScaleAzimuthFront(float azimuth, float scale)
|
||||
{
|
||||
ALfloat sign = (azimuth < 0.0f) ? -1.0f : 1.0f;
|
||||
ALfloat sign = copysignf(1.0f, azimuth);
|
||||
if(!(fabsf(azimuth) > F_PI_2))
|
||||
return minf(fabsf(azimuth) * scale, F_PI_2) * sign;
|
||||
return azimuth;
|
||||
|
@ -40,6 +40,19 @@ static inline float cbrtf(float f)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_COPYSIGNF
|
||||
static inline float copysignf(float x, float y)
|
||||
{
|
||||
union {
|
||||
float f;
|
||||
unsigned int u;
|
||||
} ux = { x }, uy = { y };
|
||||
ux.u &= 0x7fffffffu;
|
||||
ux.u |= (uy.u&0x80000000u);
|
||||
return ux.f;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define DEG2RAD(x) ((float)(x) * (float)(M_PI/180.0))
|
||||
#define RAD2DEG(x) ((float)(x) * (float)(180.0/M_PI))
|
||||
|
||||
|
@ -98,6 +98,9 @@
|
||||
/* Define if we have the cbrtf function */
|
||||
#cmakedefine HAVE_CBRTF
|
||||
|
||||
/* Define if we have the copysignf function */
|
||||
#cmakedefine HAVE_COPYSIGNF
|
||||
|
||||
/* Define if we have the strtof function */
|
||||
#cmakedefine HAVE_STRTOF
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user