Use std::numeric_limits for SK_FloatNaN and Infinity

The Windows header definitions of NAN and INFINITY involve overflowing
math, making clang treat them as not being constexpr. Now they're
constexpr everywhere.

Bug: skia:
Change-Id: I84c05aae2952a152fed4eceb55cd2680d6fd5b05
Reviewed-on: https://skia-review.googlesource.com/c/166840
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2018-10-31 13:30:52 -04:00 committed by Skia Commit-Bot
parent 0dfa208450
commit 06768fc14b

View File

@ -14,6 +14,7 @@
#include <float.h>
#include <math.h>
#include <cstring>
#include <limits>
#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE1
@ -139,9 +140,9 @@ static inline float sk_double_to_float(double x) {
return static_cast<float>(x);
}
#define SK_FloatNaN NAN
#define SK_FloatInfinity (+INFINITY)
#define SK_FloatNegativeInfinity (-INFINITY)
#define SK_FloatNaN std::numeric_limits<float>::quiet_NaN()
#define SK_FloatInfinity (+std::numeric_limits<float>::infinity())
#define SK_FloatNegativeInfinity (-std::numeric_limits<float>::infinity())
static inline float sk_float_rsqrt_portable(float x) {
// Get initial estimate.