Use C99 NAN and INFINITY macros
authorMatt Turner <mattst88@gmail.com>
Wed, 1 Aug 2012 21:48:47 +0000 (14:48 -0700)
committerMatt Turner <mattst88@gmail.com>
Fri, 3 Aug 2012 22:02:09 +0000 (15:02 -0700)
src/gallium/auxiliary/util/u_format_tests.c

index d34860886e1ea92c20c565f4c31c2ad4f5c71356..26e7acb6285041f36e0adb1fb5f1514887a20640 100644 (file)
@@ -26,6 +26,7 @@
  **************************************************************************/
 
 
+#include <math.h>
 #include <float.h>
 
 #include "pipe/p_config.h"
        {{ 0,  0,  0,  0}, { 0,  0,  0,  0}, {0, 0, 0, 0}, {0, 0, 0, 0}}}
 
 
-#ifdef __GNUC__
-#define NAN __builtin_nan("")
-#define INF __builtin_inf()
-#else
-#define NAN (0.0 / 0.0)
-#define INF (1.0 / 0.0)
-#endif
-
 /**
  * Test cases.
  *
@@ -911,8 +904,8 @@ util_format_test_cases[] =
    {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(       -NAN, 0.0, 0.0, 1.0)},
 
    /* Inf */
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), UNPACKED_1x1(        INF, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), UNPACKED_1x1(       -INF, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), UNPACKED_1x1(        INFINITY, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), UNPACKED_1x1(       -INFINITY, 0.0, 0.0, 1.0)},
 
 #endif