From: Matthew Fernandez Date: Sun, 9 Oct 2022 20:15:09 +0000 (-0700) Subject: common: replace some 'MIN' usage with 'fmax' X-Git-Tag: 6.0.2~3^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6abc25d8b10e6adb606aa43095bba325091d3a47;p=graphviz common: replace some 'MIN' usage with 'fmax' `fmin` is typically implemented as a compiler built-in and has the potential to be more efficient than `MIN`, 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 f7b9266ab..393ed9ff5 100644 --- a/lib/common/ellipse.c +++ b/lib/common/ellipse.c @@ -54,8 +54,6 @@ #include #include -#define MIN(a,b) ((a)<(b)?(a):(b)) - typedef struct { double x, y; } pointf; @@ -171,11 +169,11 @@ static void computeBounds(ellipse_t * ep) ep->xLeft = (etaXMin <= ep->eta2) ? (ep->cx + ep->a * cos(etaXMin) * ep->cosTheta - ep->b * sin(etaXMin) * ep->sinTheta) - : MIN(ep->x1, ep->x2); + : fmin(ep->x1, ep->x2); ep->yUp = (etaYMin <= ep->eta2) ? (ep->cy + ep->a * cos(etaYMin) * ep->sinTheta + ep->b * sin(etaYMin) * ep->cosTheta) - : MIN(ep->y1, ep->y2); + : fmin(ep->y1, ep->y2); ep->width = ((etaXMax <= ep->eta2) ? (ep->cx + ep->a * cos(etaXMax) * ep->cosTheta - ep->b * sin(etaXMax) * ep->sinTheta)