From 6abc25d8b10e6adb606aa43095bba325091d3a47 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 9 Oct 2022 13:15:09 -0700 Subject: [PATCH] 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. --- lib/common/ellipse.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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) -- 2.50.1