摘要: 以下是最近热议的新开源的Quake III源码中的一段tricky code,我稍作修改后如下:float CarmackInvSqrt(float x, unsigned long magicNumber){ float xhalf = 0.5f*x; int i = *(int*)&x; // get bits for floating VALUE i = magicNumber - (i>>1); // gives initial guess y0 x = *(float*)&i; // convert bits BA... 阅读全文
posted @ 2010-10-08 12:44 quanben 阅读(197) 评论(0) 推荐(0) 编辑