return (float) ldexp(x, exp);
}
+static inline float logf(float x)
+{
+ return (float) log(x);
+}
+
+static inline float expf(float x)
+{
+ return (float) exp(x);
+}
+
#else
/* Work-around an extra semi-colon in VS 2005 logf definition */
*** CEILF: ceiling of float
*** FLOORF: floor of float
*** FABSF: absolute value of float
- *** LOGF: the natural logarithm (base e) of the value
- *** EXPF: raise e to the value
***/
#if defined(__gnu_linux__)
/* C99 functions */
#define CEILF(x) ceilf(x)
#define FLOORF(x) floorf(x)
#define FABSF(x) fabsf(x)
-#define LOGF(x) logf(x)
-#define EXPF(x) expf(x)
#else
#define CEILF(x) ((GLfloat) ceil(x))
#define FLOORF(x) ((GLfloat) floor(x))
#define FABSF(x) ((GLfloat) fabs(x))
-#define LOGF(x) ((GLfloat) log(x))
-#define EXPF(x) ((GLfloat) exp(x))
#endif
if (rho2 == 0.0F)
return 0.0;
else
- return (GLfloat) (LOGF(rho2) * 1.442695 * 0.5);/* 1.442695 = 1/log(2) */
+ return logf(rho2) * 1.442695f * 0.5f;/* 1.442695 = 1/log(2) */
}
*/
+#include "c99_math.h"
#include "main/glheader.h"
#include "main/colormac.h"
#include "main/macros.h"
return CLAMP(f, 0.0F, 1.0F);
case GL_EXP:
d = ctx->Fog.Density;
- f = EXPF(-d * z);
+ f = expf(-d * z);
f = CLAMP(f, 0.0F, 1.0F);
return f;
case GL_EXP2:
d = ctx->Fog.Density;
- f = EXPF(-(d * d * z * z));
+ f = expf(-(d * d * z * z));
f = CLAMP(f, 0.0F, 1.0F);
return f;
default:
#define LINEAR_FOG(f, coord) f = (fogEnd - coord) * fogScale
-#define EXP_FOG(f, coord) f = EXPF(density * coord)
+#define EXP_FOG(f, coord) f = expf(density * coord)
#define EXP2_FOG(f, coord) \
do { \
GLfloat tmp = negDensitySquared * coord * coord; \
if (tmp < FLT_MIN_10_EXP) \
tmp = FLT_MIN_10_EXP; \
- f = EXPF(tmp); \
+ f = expf(tmp); \
} while(0)
*/
+#include "c99_math.h"
#include "main/glheader.h"
#include "main/colormac.h"
#include "main/macros.h"
GLfloat f = 0.0F;
GLint i = 0;
for ( ; i < FOG_EXP_TABLE_SIZE ; i++, f += FOG_INCR) {
- exp_table[i] = EXPF(-f);
+ exp_table[i] = expf(-f);
}
inited = 1;
}