Fix integer overflows on very large numbers

This commit is contained in:
Alug committed 2024-11-20 21:24:16 +01:00
1 parent 809ae20558
commit e66d215dd3
1 file changed
+2 -2
+2 -2
View File
@@ -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);