From: Matthew Fernandez Date: Sat, 26 Jun 2021 02:45:08 +0000 (-0700) Subject: rephrase open coded fmax/fmin in checkpath X-Git-Tag: 2.48.0~25^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3845eb93ef015f71c46cb21c36a750561bbd0c6;p=graphviz rephrase open coded fmax/fmin in checkpath --- diff --git a/lib/common/routespl.c b/lib/common/routespl.c index 4faac103e..becd347ab 100644 --- a/lib/common/routespl.c +++ b/lib/common/routespl.c @@ -767,14 +767,10 @@ static int checkpath(int boxn, boxf* boxes, path* thepath) fprintf(stderr, "in checkpath, start port not in first box\n"); printpath(thepath); } - if (thepath->start.p.x < boxes[0].LL.x) - thepath->start.p.x = boxes[0].LL.x; - if (thepath->start.p.x > boxes[0].UR.x) - thepath->start.p.x = boxes[0].UR.x; - if (thepath->start.p.y < boxes[0].LL.y) - thepath->start.p.y = boxes[0].LL.y; - if (thepath->start.p.y > boxes[0].UR.y) - thepath->start.p.y = boxes[0].UR.y; + thepath->start.p.x = fmax(thepath->start.p.x, boxes[0].LL.x); + thepath->start.p.x = fmin(thepath->start.p.x, boxes[0].UR.x); + thepath->start.p.y = fmax(thepath->start.p.y, boxes[0].LL.y); + thepath->start.p.y = fmin(thepath->start.p.y, boxes[0].UR.y); } if (thepath->end.p.x < boxes[boxn - 1].LL.x || thepath->end.p.x > boxes[boxn - 1].UR.x @@ -784,14 +780,10 @@ static int checkpath(int boxn, boxf* boxes, path* thepath) fprintf(stderr, "in checkpath, end port not in last box\n"); printpath(thepath); } - if (thepath->end.p.x < boxes[boxn - 1].LL.x) - thepath->end.p.x = boxes[boxn - 1].LL.x; - if (thepath->end.p.x > boxes[boxn - 1].UR.x) - thepath->end.p.x = boxes[boxn - 1].UR.x; - if (thepath->end.p.y < boxes[boxn - 1].LL.y) - thepath->end.p.y = boxes[boxn - 1].LL.y; - if (thepath->end.p.y > boxes[boxn - 1].UR.y) - thepath->end.p.y = boxes[boxn - 1].UR.y; + thepath->end.p.x = fmax(thepath->end.p.x, boxes[boxn - 1].LL.x); + thepath->end.p.x = fmin(thepath->end.p.x, boxes[boxn - 1].UR.x); + thepath->end.p.y = fmax(thepath->end.p.y, boxes[boxn - 1].LL.y); + thepath->end.p.y = fmin(thepath->end.p.y, boxes[boxn - 1].UR.y); } return 0; }