Update lmms_math.h

fix fastSqrt
This commit is contained in:
Vesa V
2014-11-30 02:22:23 +02:00
parent 5e6482e17b
commit 42ae62d757

View File

@@ -231,9 +231,14 @@ static inline float sqrt_neg( float val )
// fast approximation of square root
float fastSqrt( float n )
{
int i = *(int*) &n;
i = ( i + ( 127 << 23 ) ) >> 1;
return *(float*) &i;
union
{
int i;
float f;
} u;
u.f = n;
u.i = ( u.i + ( 127 << 23 ) ) >> 1;
return u.f;
}