gallium/util: Use GCC built-in functions for NaN and infinity.
authorVinson Lee <vlee@freedesktop.org>
Sun, 29 Jul 2012 22:12:05 +0000 (15:12 -0700)
committerVinson Lee <vlee@freedesktop.org>
Tue, 31 Jul 2012 06:27:19 +0000 (23:27 -0700)
This patch fixes this build failure with Intel Compiler.

src/gallium/auxiliary/util/u_format_tests.c(903): error: floating-point operation result is out of range
     {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c01), UNPACKED_1x1(        NAN, 0.0, 0.0, 1.0)},

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/util/u_format_tests.c

index 457fda6c8996c9e44416d573b4a320e64326f8bf..d34860886e1ea92c20c565f4c31c2ad4f5c71356 100644 (file)
        {{ 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.