From e66d215dd309fb6c9892c80ee90035efb485d97c Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 20 Nov 2024 20:36:22 +0100 Subject: [PATCH] Fix integer overflows on very large numbers --- src/r_main.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_main.h b/src/r_main.h index 6b7c88de3..f173307b7 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -77,7 +77,7 @@ INT32 R_PointOnSide(fixed_t x, fixed_t y, const node_t *node); FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSideRender(fixed_t x, fixed_t y, const node_t *node) { // use cross product to determine side quickly - return (INT64)(y - node->y) * node->dx - (INT64)(x - node->x) * node->dy > 0; + return ((INT64)y - node->y) * node->dx - ((INT64)x - node->x) * node->dy > 0; } FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line) @@ -88,7 +88,7 @@ FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSegSide(fixed_t x, fixed_t fixed_t ldy = line->v2->y - ly; // use cross product to determine side quickly - return (INT64)(y - ly) * ldx - (INT64)(x - lx) * ldy > 0; + return ((INT64)y - ly) * ldx - ((INT64)x - lx) * ldy > 0; } angle_t R_PointToAngle(fixed_t x, fixed_t y);