mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
Revert "Abyss crash prevention code", but make the overflow explicit.
git-svn-id: https://svn.eduke32.com/eduke32@3028 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
aba1ce9e7f
commit
5957e0f143
1 changed files with 7 additions and 3 deletions
|
@ -11667,10 +11667,14 @@ restart_grand:
|
|||
if ((cstat&64) != 0)
|
||||
if ((sv->z > intz) == ((cstat&8)==0)) continue;
|
||||
|
||||
#if 0 // Abyss crash prevention code ((intz-sv->z)*zx overflowing a 8-bit word)
|
||||
zz=(int32_t)((intz-sv->z)*vx);
|
||||
#if 1
|
||||
// Abyss crash prevention code ((intz-sv->z)*zx overflowing a 8-bit word)
|
||||
// PK: the reason for the crash is not the overflowing (even if it IS a problem;
|
||||
// signed overflow is undefined behavior in C), but rather the idiv trap when
|
||||
// the resulting quotient doesn't fit into a *signed* 32-bit integer.
|
||||
zz = (uint32_t)(intz-sv->z) * vx;
|
||||
intx = sv->x+scale(zz,1,vz);
|
||||
zz=(int32_t)((intz-sv->z)*vy);
|
||||
zz = (uint32_t)(intz-sv->z) * vy;
|
||||
inty = sv->y+scale(zz,1,vz);
|
||||
#else
|
||||
intx = sv->x+scale(intz-sv->z,vx,vz);
|
||||
|
|
Loading…
Reference in a new issue