[Piglit] [PATCH 3/7] tests/util: INFINITY/NAN are defined on MSVC 2013.
jfonseca at vmware.com
jfonseca at vmware.com
Fri Nov 7 06:21:26 PST 2014
From: José Fonseca <jfonseca at vmware.com>
---
tests/shaders/shader_runner.c | 8 ++------
tests/util/piglit-util.h | 7 -------
2 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 1f93216..628ef44 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -1147,10 +1147,6 @@ static double
strtod_inf(const char *nptr, char **endptr)
{
#if defined(_MSC_VER)
- /* Define our own infinty value here */
- const unsigned inf_u = 0x7f800000;
- const float inf = *((float *) &inf_u);
-
/* skip spaces and tabs */
while (*nptr == ' ' || *nptr == '\t')
nptr++;
@@ -1158,12 +1154,12 @@ strtod_inf(const char *nptr, char **endptr)
if (nptr[0] == 'i' && nptr[1] == 'n' && nptr[2] == 'f') {
/* +infinity */
*endptr = (char *) (nptr + 3);
- return inf;
+ return INFINITY;
}
else if (nptr[0] == '-' && nptr[1] == 'i' && nptr[2] == 'n' && nptr[3] == 'f') {
/* -infinity */
*endptr = (char *) (nptr + 4);
- return -inf;
+ return -INFINITY;
}
/* fall-through */
#endif
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index cc3b421..1c1d27e 100755
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -94,13 +94,6 @@ int asprintf(char **strp, const char *fmt, ...) PRINTFLIKE(2, 3);
#endif
#endif
-// Trick from http://tdistler.com/2011/03/24/how-to-define-nan-not-a-number-on-windows
-#ifndef INFINITY
-# define INFINITY (FLT_MAX + FLT_MAX)
-#endif
-#ifndef NAN
-# define NAN (INFINITY - INFINITY)
-#endif
enum piglit_result {
PIGLIT_PASS,
--
1.9.1
More information about the Piglit
mailing list