Fast Inverse Square root

inline float
FastInvSqrt( float x )
{
float xHalf = 0.5f * x;
int i = *(int*)&x;
i = 0x5f3759df - (i>>1);
x = *(float*)&i;
x = x*(1.5f-xHalf*x*x); // 1st Newton iteration
//x = x*(1.5f-xHalf*x*x); // 2nd Newton iteration
return x;
}