From bce066f3d0c820bd1272f54c3be15836f87d2f2a Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 20 Nov 2024 16:07:22 +0100 Subject: [PATCH] slightly optimize P_CreateBlockMap --- src/p_setup.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 5eb0c714a..2706323a3 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1508,16 +1508,23 @@ static void P_CreateBlockMap(void) // First find limits of map for (i = 0; i < numvertexes; i++) { - if (vertexes[i].x>>FRACBITS < minx) - minx = vertexes[i].x>>FRACBITS; - else if (vertexes[i].x>>FRACBITS > maxx) - maxx = vertexes[i].x>>FRACBITS; - if (vertexes[i].y>>FRACBITS < miny) - miny = vertexes[i].y>>FRACBITS; - else if (vertexes[i].y>>FRACBITS > maxy) - maxy = vertexes[i].y>>FRACBITS; + fixed_t t; + + if ((t = vertexes[i].x) < minx) + minx = t; + else if (t > maxx) + maxx = t; + if ((t = vertexes[i].y) < miny) + miny = t; + else if (t > maxy) + maxy = t; } + minx >>= FRACBITS; + maxx >>= FRACBITS; + miny >>= FRACBITS; + maxy >>= FRACBITS; + // Save blockmap parameters bmaporgx = minx << FRACBITS; bmaporgy = miny << FRACBITS;