Mesa (master): mesa: Remove _mesa_pow(), which is always just pow().

Eric Anholt anholt at kemper.freedesktop.org
Thu May 13 20:03:16 UTC 2010


Module: Mesa
Branch: master
Commit: fef303bc94f2fb15a068563ac8abfb1765bde035
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fef303bc94f2fb15a068563ac8abfb1765bde035

Author: Eric Anholt <eric at anholt.net>
Date:   Wed May  5 08:29:13 2010 -0700

mesa: Remove _mesa_pow(), which is always just pow().

---

 src/mesa/drivers/x11/xm_api.c    |    8 ++++----
 src/mesa/main/imports.c          |    9 ---------
 src/mesa/main/imports.h          |    3 ---
 src/mesa/main/light.c            |    4 ++--
 src/mesa/main/light.h            |    2 +-
 src/mesa/main/texcompress_s3tc.c |    2 +-
 src/mesa/main/texfetch.c         |    2 +-
 src/mesa/main/texgetimage.c      |    2 +-
 src/mesa/shader/prog_execute.c   |    8 ++++----
 9 files changed, 14 insertions(+), 26 deletions(-)

diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index a1723fa..dac1668 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -210,7 +210,7 @@ gamma_adjust( GLfloat gamma, GLint value, GLint max )
    }
    else {
       double x = (double) value / (double) max;
-      return IROUND_POS((GLfloat) max * _mesa_pow(x, 1.0F/gamma));
+      return IROUND_POS((GLfloat) max * pow(x, 1.0F/gamma));
    }
 }
 
@@ -846,19 +846,19 @@ setup_8bit_hpcr(XMesaVisual v)
 
    g = 1.0 / v->RedGamma;
    for (i=0; i<256; i++) {
-      GLint red = IROUND_POS(255.0 * _mesa_pow( hpcr_rgbTbl[0][i]/255.0, g ));
+      GLint red = IROUND_POS(255.0 * pow( hpcr_rgbTbl[0][i]/255.0, g ));
       v->hpcr_rgbTbl[0][i] = CLAMP( red, 16, 239 );
    }
 
    g = 1.0 / v->GreenGamma;
    for (i=0; i<256; i++) {
-      GLint green = IROUND_POS(255.0 * _mesa_pow( hpcr_rgbTbl[1][i]/255.0, g ));
+      GLint green = IROUND_POS(255.0 * pow( hpcr_rgbTbl[1][i]/255.0, g ));
       v->hpcr_rgbTbl[1][i] = CLAMP( green, 16, 239 );
    }
 
    g = 1.0 / v->BlueGamma;
    for (i=0; i<256; i++) {
-      GLint blue = IROUND_POS(255.0 * _mesa_pow( hpcr_rgbTbl[2][i]/255.0, g ));
+      GLint blue = IROUND_POS(255.0 * pow( hpcr_rgbTbl[2][i]/255.0, g ));
       v->hpcr_rgbTbl[2][i] = CLAMP( blue, 32, 223 );
    }
    v->undithered_pf = PF_HPCR;  /* can't really disable dithering for now */
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index b1389b2..1c4b219 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -486,15 +486,6 @@ _mesa_inv_sqrtf(float n)
 #endif
 }
 
-
-/** Wrapper around pow() */
-double
-_mesa_pow(double x, double y)
-{
-   return pow(x, y);
-}
-
-
 /**
  * Find the first bit set in a word.
  */
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 1c263aa..a9e44a0 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -548,9 +548,6 @@ _mesa_inv_sqrtf(float x);
 extern void
 _mesa_init_sqrt_table(void);
 
-extern double
-_mesa_pow(double x, double y);
-
 extern int
 _mesa_ffs(int32_t i);
 
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 19dc968..453ce4d 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -950,7 +950,7 @@ validate_spot_exp_table( struct gl_light *l )
 
    for (i = EXP_TABLE_SIZE - 1; i > 0 ;i--) {
       if (clamp == 0) {
-	 tmp = _mesa_pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent);
+	 tmp = pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent);
 	 if (tmp < FLT_MIN * 100.0) {
 	    tmp = 0.0;
 	    clamp = 1;
@@ -1012,7 +1012,7 @@ validate_shine_table( GLcontext *ctx, GLuint side, GLfloat shininess )
             GLdouble t, x = j / (GLfloat) (SHINE_TABLE_SIZE - 1);
             if (x < 0.005) /* underflow check */
                x = 0.005;
-            t = _mesa_pow(x, shininess);
+            t = pow(x, shininess);
 	    if (t > 1e-20)
 	       m[j] = (GLfloat) t;
 	    else
diff --git a/src/mesa/main/light.h b/src/mesa/main/light.h
index 9c1a5ee..b343611 100644
--- a/src/mesa/main/light.h
+++ b/src/mesa/main/light.h
@@ -94,7 +94,7 @@ do {									\
    int k = (int) f;							\
    if (k < 0 /* gcc may cast an overflow float value to negative int value*/ \
 	|| k > SHINE_TABLE_SIZE-2)					\
-      result = (GLfloat) _mesa_pow( dp, _tab->shininess );		\
+      result = (GLfloat) pow( dp, _tab->shininess );		\
    else									\
       result = _tab->tab[k] + (f-k)*(_tab->tab[k+1]-_tab->tab[k]);	\
 } while (0)
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
index 12c2e90..85c394b 100644
--- a/src/mesa/main/texcompress_s3tc.c
+++ b/src/mesa/main/texcompress_s3tc.c
@@ -78,7 +78,7 @@ nonlinear_to_linear(GLubyte cs8)
             table[i] = cs / 12.92f;
          }
          else {
-            table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4);
+            table[i] = (GLfloat) pow((cs + 0.055) / 1.055, 2.4);
          }
       }
       tableReady = GL_TRUE;
diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c
index 3169f3b..24d2913 100644
--- a/src/mesa/main/texfetch.c
+++ b/src/mesa/main/texfetch.c
@@ -60,7 +60,7 @@ nonlinear_to_linear(GLubyte cs8)
             table[i] = cs / 12.92f;
          }
          else {
-            table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4);
+            table[i] = (GLfloat) pow((cs + 0.055) / 1.055, 2.4);
          }
       }
       tableReady = GL_TRUE;
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 7ad9180..00134ea 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -224,7 +224,7 @@ linear_to_nonlinear(GLfloat cl)
       cs = 12.92f * cl;
    }
    else {
-      cs = (GLfloat)(1.055 * _mesa_pow(cl, 0.41666) - 0.055);
+      cs = (GLfloat)(1.055 * pow(cl, 0.41666) - 0.055);
    }
    return cs;
 }
diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index 0067512..0eae8cd 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -876,7 +876,7 @@ _mesa_execute_program(GLcontext * ctx,
                 * result.z = result.x * APPX(result.y)
                 * We do what the ARB extension says.
                 */
-               q[2] = (GLfloat) _mesa_pow(2.0, t[0]);
+               q[2] = (GLfloat) pow(2.0, t[0]);
             }
             q[1] = t[0] - floor_t0;
             q[3] = 1.0F;
@@ -887,7 +887,7 @@ _mesa_execute_program(GLcontext * ctx,
          {
             GLfloat a[4], result[4], val;
             fetch_vector1(&inst->SrcReg[0], machine, a);
-            val = (GLfloat) _mesa_pow(2.0, a[0]);
+            val = (GLfloat) pow(2.0, a[0]);
             /*
             if (IS_INF_OR_NAN(val))
                val = 1.0e10;
@@ -1009,7 +1009,7 @@ _mesa_execute_program(GLcontext * ctx,
                if (a[1] == 0.0 && a[3] == 0.0)
                   result[2] = 1.0F;
                else
-                  result[2] = (GLfloat) _mesa_pow(a[1], a[3]);
+                  result[2] = (GLfloat) pow(a[1], a[3]);
             }
             else {
                result[2] = 0.0F;
@@ -1336,7 +1336,7 @@ _mesa_execute_program(GLcontext * ctx,
             fetch_vector1(&inst->SrcReg[0], machine, a);
             fetch_vector1(&inst->SrcReg[1], machine, b);
             result[0] = result[1] = result[2] = result[3]
-               = (GLfloat) _mesa_pow(a[0], b[0]);
+               = (GLfloat) pow(a[0], b[0]);
             store_vector4(inst, machine, result);
          }
          break;




More information about the mesa-commit mailing list