Index: D:/code/nel/include/nel/misc/fast_floor.h =================================================================== --- D:/code/nel/include/nel/misc/fast_floor.h (revision 1675) +++ D:/code/nel/include/nel/misc/fast_floor.h (working copy) @@ -33,10 +33,12 @@ // fastFloor function. // Actually, it seems to be bugged on VC7 (functions returns bad values) // TODO: fix that -#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) - // && defined(NL_COMP_VC6) +#if defined(NL_OS_WINDOWS) #include +#ifdef NL_NO_ASM + #include +#endif // The magic constant value. support both positive and negative numbers. extern double OptFastFloorMagicConst ; @@ -74,7 +76,12 @@ // Force __stdcall to not pass parameters in registers. inline sint32 __stdcall OptFastFloor(float x) { - static __int64 res; +#ifdef NL_NO_ASM + __m128 a; + a.m128_f32[0] = x; + return _mm_cvtss_si32(a); +#else + static __int64 res; __asm { fld x @@ -83,12 +90,16 @@ } return (sint32) (res&0xFFFFFFFF); +#endif } // Force __stdcall to not pass parameters in registers. inline float __stdcall OptFastFractionnalPart(float x) { +#ifdef NL_NO_ASM + return x - OptFastFloor(x); +#else static double res; __asm { @@ -101,6 +112,7 @@ } return * (float *) &res; +#endif } @@ -122,6 +134,11 @@ /// Same method as OptFastFloor, but result are always positive and should never be bigger than 2^23-1 inline uint32 __stdcall OptFastFloor24(float x) { +#ifdef NL_NO_ASM + __m128 a; + a.m128_f32[0] = x; + return (uint32)_mm_cvtss_si32(a); +#else static uint32 res; __asm { @@ -131,6 +148,7 @@ } return res; +#endif }