Replace Fabs() macro with fabs() function
gcc generates better code with fabs() anyway. Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Tested-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
parent
40a47bd628
commit
9eab5b3443
|
@ -139,9 +139,6 @@ typedef struct _xReq *xReqPtr;
|
||||||
* it in case we haven't done that yet.
|
* it in case we haven't done that yet.
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
#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))
|
#define sign(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0))
|
||||||
/* this assumes b > 0 */
|
/* this assumes b > 0 */
|
||||||
#define modulus(a, b, d) if (((d) = (a) % (b)) < 0) (d) += (b)
|
#define modulus(a, b, d) if (((d) = (a) % (b)) < 0) (d) += (b)
|
||||||
|
|
|
@ -1487,7 +1487,7 @@ miDatan2 (double dy, double dx)
|
||||||
if (dy > 0)
|
if (dy > 0)
|
||||||
return 90.0;
|
return 90.0;
|
||||||
return -90.0;
|
return -90.0;
|
||||||
} else if (Fabs (dy) == Fabs (dx)) {
|
} else if (fabs (dy) == fabs (dx)) {
|
||||||
if (dy > 0) {
|
if (dy > 0) {
|
||||||
if (dx > 0)
|
if (dx > 0)
|
||||||
return 45.0;
|
return 45.0;
|
||||||
|
|
|
@ -51,12 +51,12 @@ SOFTWARE.
|
||||||
#include <X11/Xfuncproto.h>
|
#include <X11/Xfuncproto.h>
|
||||||
|
|
||||||
#define EPSILON 0.000001
|
#define EPSILON 0.000001
|
||||||
#define ISEQUAL(a,b) (Fabs((a) - (b)) <= EPSILON)
|
#define ISEQUAL(a,b) (fabs((a) - (b)) <= EPSILON)
|
||||||
#define UNEQUAL(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 : \
|
#define WITHINHALF(a, b) (((a) - (b) > 0.0) ? (a) - (b) < 0.5 : \
|
||||||
(b) - (a) <= 0.5)
|
(b) - (a) <= 0.5)
|
||||||
#define ROUNDTOINT(x) ((int) (((x) > 0.0) ? ((x) + 0.5) : ((x) - 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 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 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))
|
#define PtEqual(a, b) (((a).x == (b).x) && ((a).y == (b).y))
|
||||||
|
|
|
@ -322,7 +322,7 @@ miPolyBuildEdge (
|
||||||
{
|
{
|
||||||
double realk, kerror;
|
double realk, kerror;
|
||||||
realk = x0 * dy - y0 * dx;
|
realk = x0 * dy - y0 * dx;
|
||||||
kerror = Fabs (realk - k);
|
kerror = fabs (realk - k);
|
||||||
if (kerror > .1)
|
if (kerror > .1)
|
||||||
printf ("realk: %g k: %g\n", realk, k);
|
printf ("realk: %g k: %g\n", realk, k);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue