mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-25 19:55:54 +01:00
gcc told me copysignf() in FloatToInt() didn't do anything. oops.
sometimes using GCC *does* find problems clang didn't :)
This commit is contained in:
parent
fd52a044d4
commit
c74fa69bf6
|
@ -314,8 +314,7 @@ inline SLONG FloatToInt( FLOAT f)
|
||||||
{
|
{
|
||||||
#if defined(__arm__) || defined(USE_PORTABLE_C)
|
#if defined(__arm__) || defined(USE_PORTABLE_C)
|
||||||
// round to nearest by adding/subtracting 0.5 (depending on f pos/neg) before converting to SLONG
|
// round to nearest by adding/subtracting 0.5 (depending on f pos/neg) before converting to SLONG
|
||||||
float addToRound = 0.5f;
|
float addToRound = copysignf(0.5f, f); // copy f's signbit to 0.5 => if f<0 then addToRound = -0.5, else 0.5
|
||||||
copysignf(addToRound, f); // copy f's signbit to addToRound => if f<0 then addToRound = -addToRound
|
|
||||||
return((SLONG) (f + addToRound));
|
return((SLONG) (f + addToRound));
|
||||||
|
|
||||||
#elif (defined __MSVC_INLINE__)
|
#elif (defined __MSVC_INLINE__)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user