From: Brian Paul Date: Tue, 24 Feb 2015 15:57:17 +0000 (-0700) Subject: mesa: replace FREXPF, LDEXPF with frexpf, ldexpf X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e25f7772cacef8673318a7bfb33b151c5bc5d94c;p=mesa.git mesa: replace FREXPF, LDEXPF with frexpf, ldexpf Start getting rid of some imports.h macros. Use the c99 functions instead. Reviewed-by: Matt Turner --- diff --git a/include/c99_math.h b/include/c99_math.h index 6680f540db3..bb4bbd1a07f 100644 --- a/include/c99_math.h +++ b/include/c99_math.h @@ -82,6 +82,17 @@ static inline float logf( float f ) 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 diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 0fcba4fb986..cb871481c1f 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -209,8 +209,6 @@ static inline GLfloat LOG2(GLfloat x) *** 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 */ @@ -219,16 +217,12 @@ static inline GLfloat LOG2(GLfloat x) #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 diff --git a/src/mesa/math/m_debug_util.h b/src/mesa/math/m_debug_util.h index d05da89949c..25ee029cebc 100644 --- a/src/mesa/math/m_debug_util.h +++ b/src/mesa/math/m_debug_util.h @@ -32,6 +32,9 @@ #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 ;) @@ -286,9 +289,9 @@ static int significand_match( GLfloat a, GLfloat b ) 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; diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c index 8f83c311ece..05c5f29c3e0 100644 --- a/src/mesa/program/prog_execute.c +++ b/src/mesa/program/prog_execute.c @@ -35,6 +35,7 @@ */ +#include "c99_math.h" #include "main/glheader.h" #include "main/colormac.h" #include "main/macros.h" @@ -718,7 +719,7 @@ _mesa_execute_program(struct gl_context * ctx, 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. @@ -884,7 +885,7 @@ _mesa_execute_program(struct gl_context * ctx, } 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) */