mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
FixedDiv2: divide numerator before taking absolute value to avoid INT32_MIN overflow to 0
This commit is contained in:
parent
81a4cb17c0
commit
ef0ff01ef1
1 changed files with 1 additions and 1 deletions
|
|
@ -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)
|
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 (a^b) < 0 ? INT32_MIN : INT32_MAX;
|
||||||
|
|
||||||
return FixedDiv2(a, b);
|
return FixedDiv2(a, b);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue