From f8945a62aa85439b0d000ca0d58857377a18c7eb Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 2 Sep 2025 22:17:46 +0200 Subject: [PATCH] cache patch width MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit just to avoid some cache misses in a rather tight lööp --- src/r_patch.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/r_patch.c b/src/r_patch.c index 587d79153..3f7fdc983 100644 --- a/src/r_patch.c +++ b/src/r_patch.c @@ -726,7 +726,9 @@ UINT16 R_GetPatchPixel(patch_t *patch, INT32 x, INT32 y, boolean flip) void R_PatchToPixels(patch_t *patch, UINT8 *dst) { - for (INT32 x = 0; x < patch->width; ++x) + const INT16 width = patch->width; + + for (INT32 x = 0; x < width; ++x) { INT32 y = 0; INT32 prevdelta = -1; @@ -752,7 +754,7 @@ void R_PatchToPixels(patch_t *patch, UINT8 *dst) pixel = source[y-topdelta]; } - dst[(y*patch->width) + x] = pixel; + dst[(y*width) + x] = pixel; } column = (column_t *)((UINT8 *)column + column->length + 4);