Merge branch 'fixeddiv-overflow' into 'master'

Fix #263

Closes #263

See merge request KartKrew/Kart!681
This commit is contained in:
Sal 2022-09-15 05:54:37 +00:00
commit 41593330a8

View file

@ -204,7 +204,7 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedInt(fixed_t a)
*/
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedDiv(fixed_t a, fixed_t b)
{
if ((abs(a) >> (FRACBITS-2)) >= abs(b))
if ((abs(a / (FRACUNIT/4))) >= abs(b))
return (a^b) < 0 ? INT32_MIN : INT32_MAX;
return FixedDiv2(a, b);