GLfloat *f = (GLfloat *) ((GLubyte *) data + binding->Stride * j);
GLint k;
for (k = 0; k < array->Format.Size; k++) {
- if (IS_INF_OR_NAN(f[k]) || f[k] >= 1.0e20F || f[k] <= -1.0e10F) {
+ if (util_is_inf_or_nan(f[k]) || f[k] >= 1.0e20F || f[k] <= -1.0e10F) {
printf("Bad array data:\n");
printf(" Element[%u].%u = %f\n", j, k, f[k]);
printf(" Array %u at %p\n", attrib, (void *) array);
array->Ptr, bo ? bo->Name : 0);
f[k] = 1.0F; /* XXX replace the bad value! */
}
- /*assert(!IS_INF_OR_NAN(f[k])); */
+ /*assert(!util_is_inf_or_nan(f[k])); */
}
}
break;
}
#ifdef NAN_CHECK
- assert(!IS_INF_OR_NAN(result[0]));
- assert(!IS_INF_OR_NAN(result[0]));
- assert(!IS_INF_OR_NAN(result[0]));
- assert(!IS_INF_OR_NAN(result[0]));
+ assert(!util_is_inf_or_nan(result[0]));
+ assert(!util_is_inf_or_nan(result[0]));
+ assert(!util_is_inf_or_nan(result[0]));
+ assert(!util_is_inf_or_nan(result[0]));
#endif
}
#if 0
if (value[0] > 1.0e10 ||
- IS_INF_OR_NAN(value[0]) ||
- IS_INF_OR_NAN(value[1]) ||
- IS_INF_OR_NAN(value[2]) || IS_INF_OR_NAN(value[3]))
+ util_is_inf_or_nan(value[0]) ||
+ util_is_inf_or_nan(value[1]) ||
+ util_is_inf_or_nan(value[2]) || util_is_inf_or_nan(value[3]))
printf("store %g %g %g %g\n", value[0], value[1], value[2], value[3]);
#endif
}
#ifdef NAN_CHECK
- assert(!IS_INF_OR_NAN(value[0]));
- assert(!IS_INF_OR_NAN(value[0]));
- assert(!IS_INF_OR_NAN(value[0]));
- assert(!IS_INF_OR_NAN(value[0]));
+ assert(!util_is_inf_or_nan(value[0]));
+ assert(!util_is_inf_or_nan(value[0]));
+ assert(!util_is_inf_or_nan(value[0]));
+ assert(!util_is_inf_or_nan(value[0]));
#endif
if (writeMask & WRITEMASK_X)
fetch_vector1(&inst->SrcReg[0], machine, a);
val = exp2f(a[0]);
/*
- if (IS_INF_OR_NAN(val))
+ if (util_is_inf_or_nan(val))
val = 1.0e10;
*/
result[0] = result[1] = result[2] = result[3] = val;
fetch_vector1(&inst->SrcReg[0], machine, t);
abs_t0 = fabsf(t[0]);
if (abs_t0 != 0.0F) {
- if (IS_INF_OR_NAN(abs_t0))
+ if (util_is_inf_or_nan(abs_t0))
{
SET_POS_INFINITY(q[0]);
q[1] = 1.0F;
if (DEBUG_PROG) {
if (a[0] == 0)
printf("RCP(0)\n");
- else if (IS_INF_OR_NAN(a[0]))
+ else if (util_is_inf_or_nan(a[0]))
printf("RCP(inf)\n");
}
result[0] = result[1] = result[2] = result[3] = 1.0F / a[0];
ctx->Const.MinLineWidthAA,
ctx->Const.MaxLineWidthAA);
- if (line.len == 0.0F || IS_INF_OR_NAN(line.len))
+ if (line.len == 0.0F || util_is_inf_or_nan(line.len))
return;
INIT_SPAN(line.span, GL_LINE);
const GLfloat botDy = vMid->attrib[VARYING_SLOT_POS][1] - vMin->attrib[VARYING_SLOT_POS][1];
const GLfloat area = majDx * botDy - botDx * majDy;
/* Do backface culling */
- if (area * bf < 0 || area == 0 || IS_INF_OR_NAN(area))
+ if (area * bf < 0 || area == 0 || util_is_inf_or_nan(area))
return;
ltor = (GLboolean) (area < 0.0F);
{
GLfloat tmp = vert0->attrib[VARYING_SLOT_POS][0] + vert0->attrib[VARYING_SLOT_POS][1]
+ vert1->attrib[VARYING_SLOT_POS][0] + vert1->attrib[VARYING_SLOT_POS][1];
- if (IS_INF_OR_NAN(tmp))
+ if (util_is_inf_or_nan(tmp))
return;
}
do { \
float tmp = (V)->attrib[VARYING_SLOT_POS][0] \
+ (V)->attrib[VARYING_SLOT_POS][1]; \
- if (IS_INF_OR_NAN(tmp)) \
+ if (util_is_inf_or_nan(tmp)) \
return; \
} while(0)
* SUB_PIXEL_BITS.
*/
+#include "util/u_math.h"
#ifndef MAX_GLUINT
#define MAX_GLUINT 0xffffffffu
{
const GLfloat area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy;
- if (IS_INF_OR_NAN(area) || area == 0.0F)
+ if (util_is_inf_or_nan(area) || area == 0.0F)
return;
if (area * bf * swrast->_BackfaceCullSign < 0.0F)
GLuint k;
GLfloat *f = (GLfloat *) srcptr;
for (k = 0; k < srcarray->Size; k++) {
- assert(!IS_INF_OR_NAN(f[k]));
+ assert(!util_is_inf_or_nan(f[k]));
assert(f[k] <= 1.0e20 && f[k] >= -1.0e20);
}
}
printf(" %u: %u: %f, %f, %f, %f\n",
i, j,
coord[j][0], coord[j][1], coord[j][2], coord[j][3]);
- assert(!IS_INF_OR_NAN(coord[j][0]));
- assert(!IS_INF_OR_NAN(coord[j][1]));
- assert(!IS_INF_OR_NAN(coord[j][2]));
- assert(!IS_INF_OR_NAN(coord[j][3]));
+ assert(!util_is_inf_or_nan(coord[j][0]));
+ assert(!util_is_inf_or_nan(coord[j][1]));
+ assert(!util_is_inf_or_nan(coord[j][2]));
+ assert(!util_is_inf_or_nan(coord[j][3]));
}
}
static inline void
check_float(float x)
{
- assert(!IS_INF_OR_NAN(x));
+ assert(!util_is_inf_or_nan(x));
assert(1.0e-15 <= x && x <= 1.0e15);
}
#endif
/*@}*/
-/**
- * finite macro.
- */
-#if defined(_MSC_VER)
-# define finite _finite
-#endif
-
-
-/***
- *** IS_INF_OR_NAN: test if float is infinite or NaN
- ***/
-#if defined(isfinite)
-#define IS_INF_OR_NAN(x) (!isfinite(x))
-#elif defined(finite)
-#define IS_INF_OR_NAN(x) (!finite(x))
-#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-#define IS_INF_OR_NAN(x) (!isfinite(x))
-#else
-#define IS_INF_OR_NAN(x) (!finite(x))
-#endif
-
-
/**********************************************************************
* Functions
*/