[Mesa-dev] [PATCH] glsl: Use INFINITY instead of std::numeric_limits<float>::infinity().

Matt Turner mattst88 at gmail.com
Wed Mar 18 10:21:03 PDT 2015


On Wed, Mar 18, 2015 at 10:18 AM, Matt Turner <mattst88 at gmail.com> wrote:
> diff --git a/src/glsl/s_expression.cpp b/src/glsl/s_expression.cpp
> index 7eaa491..f82e155 100644
> --- a/src/glsl/s_expression.cpp
> +++ b/src/glsl/s_expression.cpp
> @@ -70,7 +70,7 @@ read_atom(void *ctx, const char *&src, char *&symbol_buffer)
>     // requires strtof to parse '+INF' as +Infinity, but we still support some
>     // non-C99-compliant compilers (e.g. MSVC).
>     if (n == 4 && strncmp(src, "+INF", 4) == 0) {
> -      expr = new(ctx) s_float(std::numeric_limits<float>::infinity());
> +      expr = new(ctx) s_float(INFINITY);
>     } else {
>        // Check if the atom is a number.
>        char *float_end = NULL;
> --

There's a comment here seen at the top of this hunk that says

// Check for the special symbol '+INF', which means +Infinity.  Note: C99
// requires strtof to parse '+INF' as +Infinity, but we still support some
// non-C99-compliant compilers (e.g. MSVC).

could an MSVC user test if strof properly parses +INF with the
required versions of MSVC?


More information about the mesa-dev mailing list