Added overloaded method for reciprocal sqrt on s32.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2306 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2009-03-30 09:04:50 +00:00
parent 4f01ee6a81
commit 1d8adb3faf
1 changed files with 11 additions and 11 deletions

View File

@ -388,28 +388,28 @@ namespace core
// calculate: sqrt ( x ) // calculate: sqrt ( x )
REALINLINE f32 squareroot(const f32 f) REALINLINE f32 squareroot(const f32 f)
{ {
return sqrtf ( f ); return sqrtf(f);
} }
// calculate: sqrt ( x ) // calculate: sqrt ( x )
REALINLINE f64 squareroot(const f64 f) REALINLINE f64 squareroot(const f64 f)
{ {
return sqrt ( f ); return sqrt(f);
} }
// calculate: sqrt ( x ) // calculate: sqrt ( x )
REALINLINE s32 squareroot(const s32 f) REALINLINE s32 squareroot(const s32 f)
{ {
return (s32) sqrt ( (f32) f ); return static_cast<s32>(squareroot(static_cast<f32>(f)));
} }
// calculate: 1 / sqrt ( x ) // calculate: 1 / sqrt ( x )
REALINLINE f64 reciprocal_squareroot(const f64 x) REALINLINE f64 reciprocal_squareroot(const f64 x)
{ {
return 1.0 / sqrt ( x ); return 1.0 / sqrt(x);
} }
// calculate: 1 / sqrt ( x ) // calculate: 1 / sqrtf ( x )
REALINLINE f32 reciprocal_squareroot(const f32 f) REALINLINE f32 reciprocal_squareroot(const f32 f)
{ {
#if defined ( IRRLICHT_FAST_MATH ) #if defined ( IRRLICHT_FAST_MATH )
@ -428,21 +428,21 @@ namespace core
return y * (1.47f - 0.47f * x * y * y); return y * (1.47f - 0.47f * x * y * y);
*/ */
#else #else
return 1.f / sqrtf ( f ); return 1.f / sqrtf(f);
#endif #endif
#else // no fast math #else // no fast math
return 1.f / sqrtf ( f ); return 1.f / sqrtf(f);
#endif #endif
} }
// calculate: 1 / sqrt ( x ) // calculate: 1 / sqrtf( x )
REALINLINE s32 reciprocal_squareroot(const s32 s) REALINLINE s32 reciprocal_squareroot(const s32 x)
{ {
return (s32) ( 1.f / sqrtf ( (f32) s ) ); return static_cast<s32>(reciprocal_squareroot(static_cast<f32>(x)));
} }
// calculate: 1 / x // calculate: 1 / x
REALINLINE f32 reciprocal ( const f32 f ) REALINLINE f32 reciprocal( const f32 f )
{ {
#if defined (IRRLICHT_FAST_MATH) #if defined (IRRLICHT_FAST_MATH)