123456789101112131415
float q_qsqrt( float number) { long i; float x2,y; const float threehalfs = 1.5f; x2 = number * 0.5f; y = number; i = * ( long * ) &y; i = 0x5f3759df - ( i >> 1); y = * ( float *) &i; y = y * ( threehalfs - ( x2 * y * y) ); return y; }
123456789101112
float q_sqrt( float number) { long i; float y; y = number; i = * ( long * ) &y; i = (1 << 29) + (i >> 1) - (1 << 22) + (-0x4b0d2); y = * ( float *) &i; return y; }