[Mesa-dev] [PATCH 04/12] mesa: replace FLOORF with floorf

Brian Paul brianp at vmware.com
Tue Feb 24 08:57:28 PST 2015


---
 src/mesa/main/dlist.c           |  3 ++-
 src/mesa/main/imports.h         |  3 ---
 src/mesa/program/prog_execute.c | 18 +++++++++---------
 3 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index ff9ab07..431c4b4 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -29,6 +29,7 @@
  * Display lists management functions.
  */
 
+#include "c99_math.h"
 #include "glheader.h"
 #include "imports.h"
 #include "api_arrayelt.h"
@@ -912,7 +913,7 @@ translate_id(GLsizei n, GLenum type, const GLvoid * list)
       return (GLint) uiptr[n];
    case GL_FLOAT:
       fptr = (GLfloat *) list;
-      return (GLint) FLOORF(fptr[n]);
+      return (GLint) floorf(fptr[n]);
    case GL_2_BYTES:
       ubptr = ((GLubyte *) list) + 2 * n;
       return (GLint) ubptr[0] * 256
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index bcbcd0f..9dee565 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -204,15 +204,12 @@ static inline GLfloat LOG2(GLfloat x)
 
 
 /***
- *** FLOORF: floor of float
  *** FABSF: absolute value of float
  ***/
 #if defined(__gnu_linux__)
 /* C99 functions */
-#define FLOORF(x)  floorf(x)
 #define FABSF(x)   fabsf(x)
 #else
-#define FLOORF(x)  ((GLfloat) floor(x))
 #define FABSF(x)   ((GLfloat) fabs(x))
 #endif
 
diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c
index 05c5f29..8ae015f 100644
--- a/src/mesa/program/prog_execute.c
+++ b/src/mesa/program/prog_execute.c
@@ -709,7 +709,7 @@ _mesa_execute_program(struct gl_context * ctx,
          {
             GLfloat t[4], q[4], floor_t0;
             fetch_vector1(&inst->SrcReg[0], machine, t);
-            floor_t0 = FLOORF(t[0]);
+            floor_t0 = floorf(t[0]);
             if (floor_t0 > FLT_MAX_EXP) {
                SET_POS_INFINITY(q[0]);
                SET_POS_INFINITY(q[2]);
@@ -748,10 +748,10 @@ _mesa_execute_program(struct gl_context * ctx,
          {
             GLfloat a[4], result[4];
             fetch_vector4(&inst->SrcReg[0], machine, a);
-            result[0] = FLOORF(a[0]);
-            result[1] = FLOORF(a[1]);
-            result[2] = FLOORF(a[2]);
-            result[3] = FLOORF(a[3]);
+            result[0] = floorf(a[0]);
+            result[1] = floorf(a[1]);
+            result[2] = floorf(a[2]);
+            result[3] = floorf(a[3]);
             store_vector4(inst, machine, result);
          }
          break;
@@ -759,10 +759,10 @@ _mesa_execute_program(struct gl_context * ctx,
          {
             GLfloat a[4], result[4];
             fetch_vector4(&inst->SrcReg[0], machine, a);
-            result[0] = a[0] - FLOORF(a[0]);
-            result[1] = a[1] - FLOORF(a[1]);
-            result[2] = a[2] - FLOORF(a[2]);
-            result[3] = a[3] - FLOORF(a[3]);
+            result[0] = a[0] - floorf(a[0]);
+            result[1] = a[1] - floorf(a[1]);
+            result[2] = a[2] - floorf(a[2]);
+            result[3] = a[3] - floorf(a[3]);
             store_vector4(inst, machine, result);
          }
          break;
-- 
1.9.1



More information about the mesa-dev mailing list