ref: 88f5ae5be28d3c472c6d4e060304b877d52ec139
parent: 22a3794c3848186631d5e5bdd61b9eefcb8563ac
parent: 21709de765d58b2ddfb69e0582e0c20147d4e774
author: Turo Lamminen <turol@users.noreply.github.com>
date: Mon Nov 14 07:30:03 EST 2022
Merge pull request #1548 from turol/integer-fixes Fix integer overflows
--- a/src/doom/p_enemy.c
+++ b/src/doom/p_enemy.c
@@ -684,7 +684,7 @@
// turn towards movement direction if not there yet
if (actor->movedir < 8)
{
- actor->angle &= (7<<29);
+ actor->angle &= (7u << 29);
delta = actor->angle - (actor->movedir << 29);
if (delta > 0)
--- a/src/heretic/p_enemy.c
+++ b/src/heretic/p_enemy.c
@@ -697,7 +697,7 @@
//
if (actor->movedir < 8)
{
- actor->angle &= (7 << 29);
+ actor->angle &= (7u << 29);
delta = actor->angle - (actor->movedir << 29);
if (delta > 0)
{
--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -697,7 +697,7 @@
//
if (actor->movedir < 8)
{
- actor->angle &= (7 << 29);
+ actor->angle &= (7u << 29);
delta = actor->angle - (actor->movedir << 29);
if (delta > 0)
{
@@ -1034,28 +1034,28 @@
switch (actor->movedir)
{
case DI_EAST:
- actor->angle = 0 << 24;
+ actor->angle = 0u << 24;
break;
case DI_NORTHEAST:
- actor->angle = 32 << 24;
+ actor->angle = 32u << 24;
break;
case DI_NORTH:
- actor->angle = 64 << 24;
+ actor->angle = 64u << 24;
break;
case DI_NORTHWEST:
- actor->angle = 96 << 24;
+ actor->angle = 96u << 24;
break;
case DI_WEST:
- actor->angle = 128 << 24;
+ actor->angle = 128u << 24;
break;
case DI_SOUTHWEST:
- actor->angle = 160 << 24;
+ actor->angle = 160u << 24;
break;
case DI_SOUTH:
- actor->angle = 192 << 24;
+ actor->angle = 192u << 24;
break;
case DI_SOUTHEAST:
- actor->angle = 224 << 24;
+ actor->angle = 224u << 24;
break;
}
}
@@ -2028,7 +2028,7 @@
//
if (actor->movedir < 8)
{
- actor->angle &= (7 << 29);
+ actor->angle &= (7u << 29);
delta = actor->angle - (actor->movedir << 29);
if (delta > 0)
{
@@ -2229,7 +2229,7 @@
//
if (actor->movedir < 8)
{
- actor->angle &= (7 << 29);
+ actor->angle &= (7u << 29);
delta = actor->angle - (actor->movedir << 29);
if (delta > 0)
{
@@ -4596,7 +4596,7 @@
//
if (actor->movedir < 8)
{
- actor->angle &= (7 << 29);
+ actor->angle &= (7u << 29);
delta = actor->angle - (actor->movedir << 29);
if (delta > 0)
{
--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -931,7 +931,7 @@
{
int delta;
- actor->angle &= (7 << 29);
+ actor->angle &= (7u << 29);
delta = actor->angle - (actor->movedir << 29);
if(delta < 0)
@@ -1062,7 +1062,7 @@
// turn towards movement direction if not there yet
if (actor->movedir < 8)
{
- actor->angle &= (7<<29);
+ actor->angle &= (7u << 29);
delta = actor->angle - (actor->movedir << 29);
if (delta > 0)