From: Matthew Fernandez Date: Sun, 9 Oct 2022 20:13:08 +0000 (-0700) Subject: common: replace some 'MAX' usage with 'fmax' X-Git-Tag: 6.0.2~3^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b5eed7f68d742949f8087812c04aa0dea178aa3a;p=graphviz common: replace some 'MAX' usage with 'fmax' `fmax` is typically implemented as a compiler built-in and has the potential to be more efficient than `MAX`, while also avoiding the loss of type safety and double-expansion problems of macros. --- diff --git a/lib/common/ellipse.c b/lib/common/ellipse.c index 79634fe11..f7b9266ab 100644 --- a/lib/common/ellipse.c +++ b/lib/common/ellipse.c @@ -47,14 +47,13 @@ */ #include +#include #include #ifdef STANDALONE #include -#include #include #include -#define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b)) typedef struct { @@ -180,11 +179,11 @@ static void computeBounds(ellipse_t * ep) ep->width = ((etaXMax <= ep->eta2) ? (ep->cx + ep->a * cos(etaXMax) * ep->cosTheta - ep->b * sin(etaXMax) * ep->sinTheta) - : MAX(ep->x1, ep->x2)) - ep->xLeft; + : fmax(ep->x1, ep->x2)) - ep->xLeft; ep->height = ((etaYMax <= ep->eta2) ? (ep->cy + ep->a * cos(etaYMax) * ep->sinTheta + ep->b * sin(etaYMax) * ep->cosTheta) - : MAX(ep->y1, ep->y2)) - ep->yUp; + : fmax(ep->y1, ep->y2)) - ep->yUp; }