diff options
author | Brian Paul <[email protected]> | 2012-09-03 12:19:15 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-09-03 18:07:41 -0600 |
commit | 56ccdf7e30f5bc1bc6b71d49bad2a9049ae170c4 (patch) | |
tree | 1d890a1708b7262c080444a8cd57948ea49a9edd /src/mesa/main | |
parent | f44bda17f515c411071ca8744ebd96039d9c583b (diff) |
mesa: remove SQRTF, use sqrtf. Convert INV_SQRT() to inline function.
We were already defining sqrtf where we don't have the C99 version.
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
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)); } |