The famous InvSqrt()

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;
}

source

Leave a Reply