Found this nice function in slashdot: http://www.beyond3d.com/articles/fastinvsqrt/
float InvSqrt( 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 );
return x;
}
Friday, December 1, 2006
Subscribe to:
Posts (Atom)