ARM processor don't convert +inf to 0xFFFFFFFF like a x86 processor do

This commit is contained in:
ptitSeb 2016-04-06 13:37:07 +02:00
parent f105e7225a
commit 0252ff1b6c

View File

@ -14,7 +14,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
#include <Engine/StdH.h> #include <Engine/StdH.h>
#pragma GCC optimize 0
#include <Engine/World/World.h> #include <Engine/World/World.h>
#include <Engine/World/PhysicsProfile.h> #include <Engine/World/PhysicsProfile.h>
#include <Engine/Templates/StaticStackArray.cpp> #include <Engine/Templates/StaticStackArray.cpp>
@ -47,10 +47,10 @@ static inline void BoxToGrid(
FLOAT fMinZ = boxEntity.Min()(3); FLOAT fMinZ = boxEntity.Min()(3);
FLOAT fMaxX = boxEntity.Max()(1); FLOAT fMaxX = boxEntity.Max()(1);
FLOAT fMaxZ = boxEntity.Max()(3); FLOAT fMaxZ = boxEntity.Max()(3);
iMinX = INDEX(floor(fMinX/GRID_CELLSIZE)); iMinX = (isinf(fMinX))?INDEX(GRID_MIN):INDEX(floor(fMinX/GRID_CELLSIZE));
iMinZ = INDEX(floor(fMinZ/GRID_CELLSIZE)); iMinZ = (isinf(fMinZ))?INDEX(GRID_MIN):INDEX(floor(fMinZ/GRID_CELLSIZE));
iMaxX = INDEX(ceil(fMaxX/GRID_CELLSIZE)); iMaxX = (isinf(fMaxX))?INDEX(GRID_MIN):INDEX(ceil(fMaxX/GRID_CELLSIZE));
iMaxZ = INDEX(ceil(fMaxZ/GRID_CELLSIZE)); iMaxZ = (isinf(fMaxZ))?INDEX(GRID_MIN):INDEX(ceil(fMaxZ/GRID_CELLSIZE));
iMinX = Clamp(iMinX, (INDEX)GRID_MIN, (INDEX)GRID_MAX); iMinX = Clamp(iMinX, (INDEX)GRID_MIN, (INDEX)GRID_MAX);
iMinZ = Clamp(iMinZ, (INDEX)GRID_MIN, (INDEX)GRID_MAX); iMinZ = Clamp(iMinZ, (INDEX)GRID_MIN, (INDEX)GRID_MAX);
@ -69,10 +69,10 @@ static inline INDEX MakeKey(INDEX iX, INDEX iZ)
//INDEX iKey = (iX+iZ)&(GRID_HASHTABLESIZE-1); // x+z //INDEX iKey = (iX+iZ)&(GRID_HASHTABLESIZE-1); // x+z
// use absolute x and z, swap upper and lower bits in z, xor x and z // use absolute x and z, swap upper and lower bits in z, xor x and z
INDEX iZ2 = abs(iZ); INDEX iZ2 = abs(iZ);
INDEX iKey = (iZ2>>(GRID_HASHTABLESIZE_LOG2/2)) | ( INDEX iKey = (iZ2>>(GRID_HASHTABLESIZE_LOG2/2));
(iZ2&(GRID_HASHTABLESIZE/2-1))<<(GRID_HASHTABLESIZE_LOG2/2)); iKey |= ((iZ2&(GRID_HASHTABLESIZE/2-1))<<(GRID_HASHTABLESIZE_LOG2/2));
iKey = iKey^abs(iX); iKey ^= abs(iX);
iKey = iKey&(GRID_HASHTABLESIZE-1); iKey &= (GRID_HASHTABLESIZE-1);
return iKey; return iKey;
} }