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

Matt Turner mattst88 at gmail.com
Wed Aug 1 14:50:16 PDT 2012


On Tue, Jul 31, 2012 at 1:16 AM, Philipp Klaus Krause <pkk at spth.de> wrote:
> This one doesn't make sense to me: For __GNUC__ it uses
> implementation-defined non-standard stuff. For other compilers it
> divides by zero, which is undefined behaviour. Why not use standard
> macros NAN and INFINITY from math.h? The standard (section 7.12 in the
> C11 standard, AFAIK the wording is the same in earlier standards) says
> that they are provided if infinity and quit nan are supported by the
> implementation.
>
> Philipp

Indeed. I wondered the same. The use of NAN/INF are inside an #if
!defined(PIPE_CC_MSVC) block, so MSVC can't be the problem. NAN and
INFINITY are c99, which I'm not sure we can assume. Then again, if not
MSVC, what compiler is the problem?

Vinson, does the attached patch work for you?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Use-C99-NAN-and-INFINITY-macros.patch
Type: application/octet-stream
Size: 1649 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120801/024b93a0/attachment.obj>


More information about the mesa-dev mailing list