#endif
-/** single-precision inverse square root */
-static inline float
-INV_SQRTF(float x)
-{
- /* XXX we could try Quake's fast inverse square root function here */
- return 1.0F / sqrtf(x);
-}
-
-
/***
*** LOG2: Log base 2 of float
***/
GLfloat f = m[2] * m[2] + m[6] * m[6] + m[10] * m[10];
if (f < 1e-12) f = 1.0;
if (ctx->_NeedEyeCoords)
- ctx->_ModelViewInvScale = (GLfloat) INV_SQRTF(f);
+ ctx->_ModelViewInvScale = 1.0f / sqrtf(f);
else
- ctx->_ModelViewInvScale = (GLfloat) sqrtf(f);
+ ctx->_ModelViewInvScale = sqrtf(f);
}
}
{
GLfloat len = (GLfloat) LEN_SQUARED_3FV(v);
if (len) {
- len = INV_SQRTF(len);
+ len = 1.0f / sqrtf(len);
v[0] *= len;
v[1] *= len;
v[2] *= len;
* Gareth Hughes
*/
+#include "c99_math.h"
#include "main/glheader.h"
#include "main/context.h"
#include "main/macros.h"
/* Hmmm, don't know how we could test the precalculated
* length case...
*/
- scale = INV_SQRTF( len );
+ scale = 1.0f / sqrtf(len);
SCALE_SCALAR_3V( out[i], scale, t );
} else {
out[i][0] = out[i][1] = out[i][2] = 0;
ASSIGN_3V( d2[i], 0.0, 0.0, 0.0 );
for ( j = 0 ; j < 3 ; j++ )
s[i][j] = rnd();
- length[i] = INV_SQRTF( LEN_SQUARED_3FV( s[i] ) );
+ length[i] = 1.0f / sqrtf( LEN_SQUARED_3FV( s[i] ) );
}
source->data = (GLfloat(*)[4]) s;
{
GLdouble len = tx*tx + ty*ty + tz*tz;
if (len > 1e-20) {
- GLfloat scale = INV_SQRTF(len);
+ GLfloat scale = 1.0f / sqrtf(len);
out[i][0] = tx * scale;
out[i][1] = ty * scale;
out[i][2] = tz * scale;
{
GLdouble len = tx*tx + ty*ty + tz*tz;
if (len > 1e-20) {
- GLfloat scale = INV_SQRTF(len);
+ GLfloat scale = 1.0f / sqrtf(len);
out[i][0] = tx * scale;
out[i][1] = ty * scale;
out[i][2] = tz * scale;
const GLfloat x = from[0], y = from[1], z = from[2];
GLdouble len = x * x + y * y + z * z;
if (len > 1e-50) {
- len = INV_SQRTF(len);
+ len = 1.0f / sqrtf(len);
out[i][0] = (GLfloat)(x * len);
out[i][1] = (GLfloat)(y * len);
out[i][2] = (GLfloat)(z * len);
* 3. Transformation of a point p by a matrix M is: p' = M * p
*/
+#include "c99_math.h"
#include "main/glheader.h"
#include "main/macros.h"
GLfloat a[4], result[4];
fetch_vector1(&inst->SrcReg[0], machine, a);
a[0] = fabsf(a[0]);
- result[0] = result[1] = result[2] = result[3] = INV_SQRTF(a[0]);
+ result[0] = result[1] = result[2] = result[3] = 1.0f / sqrtf(a[0]);
store_vector4(inst, machine, result);
if (DEBUG_PROG) {
printf("RSQ %g = 1/sqrt(|%g|)\n", result[0], a[0]);
rz = u[2] - normal[2] * two_nu;
m = rx * rx + ry * ry + (rz + 1.0F) * (rz + 1.0F);
if (m > 0.0F)
- mInv = 0.5F * INV_SQRTF(m);
+ mInv = 0.5F * (1.0f / sqrtf(m));
else
mInv = 0.0F;
for (i = 0; i < VB->Count; i++) {
const GLfloat dist = fabsf(*eyeCoord);
const GLfloat q = p0 + dist * (p1 + dist * p2);
- const GLfloat atten = (q != 0.0F) ? INV_SQRTF(q) : 1.0F;
+ const GLfloat atten = (q != 0.0F) ? (1.0f / sqrtf(q)) : 1.0F;
size[i][0] = pointSize * atten; /* clamping done in rasterization */
eyeCoord += eyeCoordStride;
}
fz = f[i][2] = u[2] - norm[2] * two_nu;
m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F);
if (m[i] != 0.0F) {
- m[i] = 0.5F * INV_SQRTF(m[i]);
+ m[i] = 0.5F * (1.0f / sqrtf(m[i]));
}
}
}
fz = f[i][2] = u[2] - norm[2] * two_nu;
m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F);
if (m[i] != 0.0F) {
- m[i] = 0.5F * INV_SQRTF(m[i]);
+ m[i] = 0.5F * (1.0f / sqrtf(m[i]));
}
}
}