[Mesa-dev] [PATCH] gallium/util: Use GCC built-in functions for NaN and infinity.

Jose Fonseca jfonseca at vmware.com
Sun Jul 29 23:14:41 PDT 2012


Looks good.

Jose

----- Original Message -----
> 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 at freedesktop.org>
> ---
>  src/gallium/auxiliary/util/u_format_tests.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/gallium/auxiliary/util/u_format_tests.c
> b/src/gallium/auxiliary/util/u_format_tests.c
> index 457fda6..d348608 100644
> --- a/src/gallium/auxiliary/util/u_format_tests.c
> +++ b/src/gallium/auxiliary/util/u_format_tests.c
> @@ -66,8 +66,13 @@
>         {{ 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.
> --
> 1.7.9.5
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list