aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-06-29 02:12:36 -0700
committerChris Robinson <[email protected]>2012-06-29 02:12:36 -0700
commit6bd535bed0101bbe91c4a1a7dc4f93167e40810c (patch)
tree6ff7dd6ab5a18cb05d8b1ebc1a92c4b430d2b838 /OpenAL32
parent524c88c4025391aa17752d329cc2d548c9a6d261 (diff)
Use wrappers for float-typed math functions
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alu.h79
-rw-r--r--OpenAL32/alFilter.c2
2 files changed, 35 insertions, 46 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 0540c699..cd8f1554 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -44,70 +44,59 @@ _CRTIMP unsigned int __cdecl __MINGW_NOTHROW _controlfp (unsigned int unNew, uns
#define F_PI (3.14159265358979323846f) /* pi */
#define F_PI_2 (1.57079632679489661923f) /* pi/2 */
-#ifdef HAVE_POWF
-#define aluPow(x,y) (powf((x),(y)))
-#else
-#define aluPow(x,y) ((ALfloat)pow((double)(x),(double)(y)))
+#ifndef HAVE_POWF
+static __inline float powf(float x, float y)
+{ return (float)pow(x, y); }
#endif
-#ifdef HAVE_SQRTF
-#define aluSqrt(x) (sqrtf((x)))
-#else
-#define aluSqrt(x) ((ALfloat)sqrt((double)(x)))
+#ifndef HAVE_SQRTF
+static __inline float sqrtf(float x)
+{ (float)sqrt(x); }
#endif
-#ifdef HAVE_COSF
-#define aluCos(x) (cosf((x)))
-#else
-#define aluCos(x) ((ALfloat)cos((double)(x)))
+#ifndef HAVE_COSF
+static __inline float cosf(float x)
+{ (float)cos(x); }
#endif
-#ifdef HAVE_SINF
-#define aluSin(x) (sinf((x)))
-#else
-#define aluSin(x) ((ALfloat)sin((double)(x)))
+#ifndef HAVE_SINF
+static __inline float sinf(float x)
+{ (float)sin(x); }
#endif
-#ifdef HAVE_ACOSF
-#define aluAcos(x) (acosf((x)))
-#else
-#define aluAcos(x) ((ALfloat)acos((double)(x)))
+#ifndef HAVE_ACOSF
+static __inline float acosf(float x)
+{ (float)acos(x); }
#endif
-#ifdef HAVE_ASINF
-#define aluAsin(x) (asinf((x)))
-#else
-#define aluAsin(x) ((ALfloat)asin((double)(x)))
+#ifndef HAVE_ASINF
+static __inline float asinf(float x)
+{ (float)asin(x); }
#endif
-#ifdef HAVE_ATANF
-#define aluAtan(x) (atanf((x)))
-#else
-#define aluAtan(x) ((ALfloat)atan((double)(x)))
+#ifndef HAVE_ATANF
+static __inline float atanf(float x)
+{ (float)atan(x); }
#endif
-#ifdef HAVE_ATAN2F
-#define aluAtan2(x,y) (atan2f((x),(y)))
-#else
-#define aluAtan2(x,y) ((ALfloat)atan2((double)(x),(double)(y)))
+#ifndef HAVE_ATAN2F
+static __inline float atan2f(float x, float y)
+{ (float)atan2(x, y); }
#endif
-#ifdef HAVE_FABSF
-#define aluFabs(x) (fabsf((x)))
-#else
-#define aluFabs(x) ((ALfloat)fabs((double)(x)))
+#ifndef HAVE_FABSF
+static __inline float fabsf(float x)
+{ (float)fabs(x); }
#endif
-#ifdef HAVE_LOG10F
-#define aluLog10(x) (log10f((x)))
-#else
-#define aluLog10(x) ((ALfloat)log10((double)(x)))
+#ifndef HAVE_LOG10F
+static __inline float log10f(float x)
+{ (float)log10(x); }
#endif
-#ifdef HAVE_FLOORF
-#define aluFloor(x) (floorf((x)))
-#else
-#define aluFloor(x) ((ALfloat)floor((double)(x)))
+#ifndef HAVE_FLOORF
+static __inline float floorf(float x)
+{ (float)floor(x); }
#endif
#ifdef __cplusplus
@@ -284,7 +273,7 @@ static __inline void aluNormalize(ALfloat *inVector)
ALfloat lengthsqr = aluDotproduct(inVector, inVector);
if(lengthsqr > 0.0f)
{
- ALfloat inv_length = 1.0f/aluSqrt(lengthsqr);
+ ALfloat inv_length = 1.0f/sqrtf(lengthsqr);
inVector[0] *= inv_length;
inVector[1] *= inv_length;
inVector[2] *= inv_length;
diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c
index d943d9f1..1250693e 100644
--- a/OpenAL32/alFilter.c
+++ b/OpenAL32/alFilter.c
@@ -336,7 +336,7 @@ ALfloat lpCoeffCalc(ALfloat g, ALfloat cw)
/* Be careful with gains < 0.001, as that causes the coefficient head
* towards 1, which will flatten the signal */
g = maxf(g, 0.001f);
- a = (1 - g*cw - aluSqrt(2*g*(1-cw) - g*g*(1 - cw*cw))) /
+ a = (1 - g*cw - sqrtf(2*g*(1-cw) - g*g*(1 - cw*cw))) /
(1 - g);
}