Fix integer overflows on very large numbers

This commit is contained in:
Alug committed 2024-11-20 20:36:22 +01:00
1 parent 138feecefc
commit 0764c335b3
1 file changed
+2 -2
+2 -2
View File
@@ -102,7 +102,7 @@ FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSide(fixed_t x, fixed_t y,
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)
@@ -113,7 +113,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);