[PATCH 5/6] Replace Fabs() macro with fabs() function

Matt Turner mattst88 at gmail.com
Wed Apr 27 16:33:05 PDT 2011


gcc generates better code with fabs() anyway.

Signed-off-by: Matt Turner <mattst88 at gmail.com>
---
 include/misc.h  |    3 ---
 mi/miarc.c      |    2 +-
 mi/mifpoly.h    |    6 +++---
 mi/miwideline.c |    2 +-
 4 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/include/misc.h b/include/misc.h
index 62ed533..4e4b1bd 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -139,9 +139,6 @@ typedef struct _xReq *xReqPtr;
  * it in case we haven't done that yet.
  */
 #include <stdlib.h>
-#ifndef Fabs
-#define Fabs(a) ((a) > 0.0 ? (a) : -(a))	/* floating absolute value */
-#endif
 #define sign(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0))
 /* this assumes b > 0 */
 #define modulus(a, b, d)    if (((d) = (a) % (b)) < 0) (d) += (b)
diff --git a/mi/miarc.c b/mi/miarc.c
index 881e0db..cd870fa 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -1487,7 +1487,7 @@ miDatan2 (double dy, double dx)
 	if (dy > 0)
 	    return 90.0;
 	return -90.0;
-    } else if (Fabs (dy) == Fabs (dx)) {
+    } else if (fabs (dy) == fabs (dx)) {
 	if (dy > 0) {
 	    if (dx > 0)
 		return 45.0;
diff --git a/mi/mifpoly.h b/mi/mifpoly.h
index ffd19a3..cc779c9 100644
--- a/mi/mifpoly.h
+++ b/mi/mifpoly.h
@@ -51,12 +51,12 @@ SOFTWARE.
 #include <X11/Xfuncproto.h>
 
 #define EPSILON	0.000001
-#define ISEQUAL(a,b) (Fabs((a) - (b)) <= EPSILON)
-#define UNEQUAL(a,b) (Fabs((a) - (b)) > EPSILON)
+#define ISEQUAL(a,b) (fabs((a) - (b)) <= EPSILON)
+#define UNEQUAL(a,b) (fabs((a) - (b)) > EPSILON)
 #define WITHINHALF(a, b) (((a) - (b) > 0.0) ? (a) - (b) < 0.5 : \
 					     (b) - (a) <= 0.5)
 #define ROUNDTOINT(x)   ((int) (((x) > 0.0) ? ((x) + 0.5) : ((x) - 0.5)))
-#define ISZERO(x) 	(Fabs((x)) <= EPSILON)
+#define ISZERO(x) 	(fabs((x)) <= EPSILON)
 #define PTISEQUAL(a,b) (ISEQUAL(a.x,b.x) && ISEQUAL(a.y,b.y))
 #define PTUNEQUAL(a,b) (UNEQUAL(a.x,b.x) || UNEQUAL(a.y,b.y))
 #define PtEqual(a, b) (((a).x == (b).x) && ((a).y == (b).y))
diff --git a/mi/miwideline.c b/mi/miwideline.c
index bc5ee74..ecda370 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -322,7 +322,7 @@ miPolyBuildEdge (
     {
 	double	realk, kerror;
     	realk = x0 * dy - y0 * dx;
-    	kerror = Fabs (realk - k);
+    	kerror = fabs (realk - k);
     	if (kerror > .1)
 	    printf ("realk: %g k: %g\n", realk, k);
     }
-- 
1.7.3.4



More information about the xorg-devel mailing list