- // 截取自Quake3源代码
- // 遵循GPL协议发布
- 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;
- }
- //该片段来自于http://www.codesnippet.cn/detail/14112012351.html
来源: http://www.codesnippet.cn/detail/14112012351.html