diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/imports.h | 22 | ||||
-rw-r--r-- | src/mesa/main/light.c | 2 | ||||
-rw-r--r-- | src/mesa/main/macros.h | 4 |
3 files changed, 13 insertions, 15 deletions
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 60b0f11af86..abf216c99ac 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -96,18 +96,6 @@ typedef union { GLfloat f; GLint i; } fi_type; #define DEG2RAD (M_PI/180.0) -/*** - *** SQRTF: single-precision square root - ***/ -#define SQRTF(X) (float) sqrt((float) (X)) - - -/*** - *** INV_SQRTF: single-precision inverse square root - ***/ -#define INV_SQRTF(X) (1.0F / SQRTF(X)) - - /** * \name Work-arounds for platforms that lack C99 math functions */ @@ -157,6 +145,16 @@ static inline int isblank(int ch) { return ch == ' ' || ch == '\t'; } /*@}*/ + +/** single-precision inverse square root */ +static inline float +INV_SQRTF(float x) +{ + /* XXX we could try Quake's fast inverse square root function here */ + return 1.0F / sqrtf(x); +} + + /*** *** LOG2: Log base 2 of float ***/ diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index cfb53dc061c..042ed1cb858 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1038,7 +1038,7 @@ update_modelview_scale( struct gl_context *ctx ) if (ctx->_NeedEyeCoords) ctx->_ModelViewInvScale = (GLfloat) INV_SQRTF(f); else - ctx->_ModelViewInvScale = (GLfloat) SQRTF(f); + ctx->_ModelViewInvScale = (GLfloat) sqrtf(f); } } diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 7d0a375d138..fc6f2a28f20 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -665,13 +665,13 @@ LEN_SQUARED_2FV(const GLfloat v[2]) static inline GLfloat LEN_3FV(const GLfloat v[3]) { - return SQRTF(LEN_SQUARED_3FV(v)); + return sqrtf(LEN_SQUARED_3FV(v)); } static inline GLfloat LEN_2FV(const GLfloat v[2]) { - return SQRTF(LEN_SQUARED_2FV(v)); + return sqrtf(LEN_SQUARED_2FV(v)); } |