Skip to content
Snippets Groups Projects
Commit a90f495b authored by Hanicef's avatar Hanicef
Browse files

Fix integer overflows on very large numbers

parent b8dd0f69
Branches
No related tags found
No related merge requests found
...@@ -75,7 +75,7 @@ extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ]; ...@@ -75,7 +75,7 @@ extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
static inline INT32 R_PointOnSide(fixed_t x, fixed_t y, node_t *node) static inline INT32 R_PointOnSide(fixed_t x, fixed_t y, node_t *node)
{ {
// use cross product to determine side quickly // 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;
} }
static inline INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *line) static inline INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *line)
...@@ -86,7 +86,7 @@ static inline INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *line) ...@@ -86,7 +86,7 @@ static inline INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *line)
fixed_t ldy = line->v2->y - ly; fixed_t ldy = line->v2->y - ly;
// use cross product to determine side quickly // 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); angle_t R_PointToAngle(fixed_t x, fixed_t y);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment