Start getting rid of some imports.h macros. Use the c99 functions instead.
Reviewed-by: Matt Turner <mattst88@gmail.com>
return (float) log( (double) f );
}
+static inline float frexpf(float x, int *exp)
+{
+ return (float) frexp(x, exp);
+}
+
+static inline float ldexpf(float x, int exp)
+{
+ return (float) ldexp(x, exp);
+}
+
+
#else
/* Work-around an extra semi-colon in VS 2005 logf definition */
#ifdef logf
*** FABSF: absolute value of float
*** LOGF: the natural logarithm (base e) of the value
*** EXPF: raise e to the value
- *** LDEXPF: multiply value by an integral power of two
- *** FREXPF: extract mantissa and exponent from value
***/
#if defined(__gnu_linux__)
/* C99 functions */
#define FABSF(x) fabsf(x)
#define LOGF(x) logf(x)
#define EXPF(x) expf(x)
-#define LDEXPF(x,y) ldexpf(x,y)
-#define FREXPF(x,y) frexpf(x,y)
#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))
-#define LDEXPF(x,y) ((GLfloat) ldexp(x,y))
-#define FREXPF(x,y) ((GLfloat) frexp(x,y))
#endif
#ifdef DEBUG_MATH /* This code only used for debugging */
+#include "c99_math.h"
+
+
/* Comment this out to deactivate the cycle counter.
* NOTE: it works only on CPUs which know the 'rdtsc' command (586 or higher)
* (hope, you don't try to debug Mesa on a 386 ;)
return 0;
}
- FREXPF( a, &a_ex );
- FREXPF( b, &b_ex );
- FREXPF( d, &d_ex );
+ frexpf( a, &a_ex );
+ frexpf( b, &b_ex );
+ frexpf( d, &d_ex );
if ( a_ex < b_ex ) {
return a_ex - d_ex;
*/
+#include "c99_math.h"
#include "main/glheader.h"
#include "main/colormac.h"
#include "main/macros.h"
q[2] = 0.0F;
}
else {
- q[0] = LDEXPF(1.0, (int) floor_t0);
+ q[0] = ldexpf(1.0, (int) floor_t0);
/* Note: GL_NV_vertex_program expects
* result.z = result.x * APPX(result.y)
* We do what the ARB extension says.
}
else {
int exponent;
- GLfloat mantissa = FREXPF(t[0], &exponent);
+ GLfloat mantissa = frexpf(t[0], &exponent);
q[0] = (GLfloat) (exponent - 1);
q[1] = (GLfloat) (2.0 * mantissa); /* map [.5, 1) -> [1, 2) */