diff options
author | mtklein <mtklein@chromium.org> | 2016-08-10 08:31:42 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-10 08:31:42 -0700 |
commit | 3ff2cc81a58b3fe5287980cf618147c84a6c81f6 (patch) | |
tree | 6de878cca8d7a083f4897ac8f6a47a45b577a5e3 /src/core/SkMath.cpp | |
parent | 6e90d42d3d5b8e51e60afbe97b27a0c16c2bacf1 (diff) |
constexpr NaN,+Inf,-Inf
Reading extern values meant these couldn't be compile-time constants.
math.h has INFINITY, which is macro that is supposed to expand to float +inf.
On MSVC it seems it's natively a double, so we cast just to make sure.
There's nan(const char*) in math.h for NaN too, but I don't trust that
to be compile-time evaluated. So instead, we keep reinterpreting a bit pattern.
I did try to write
static constexpr float float_nan() { ... }
and completely failed. constexpr seems a bit too restrictive in C++11 to make
it work, but Clang kept telling me, you'll be able to do this with C++14.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2233853002
Review-Url: https://codereview.chromium.org/2233853002
Diffstat (limited to 'src/core/SkMath.cpp')
-rw-r--r-- | src/core/SkMath.cpp | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/src/core/SkMath.cpp b/src/core/SkMath.cpp index 1f671d3949..6eff790c85 100644 --- a/src/core/SkMath.cpp +++ b/src/core/SkMath.cpp @@ -11,10 +11,6 @@ #include "SkFloatingPoint.h" #include "SkScalar.h" -const uint32_t gIEEENotANumber = 0x7FFFFFFF; -const uint32_t gIEEEInfinity = 0x7F800000; -const uint32_t gIEEENegativeInfinity = 0xFF800000; - #define sub_shift(zeros, x, n) \ zeros -= n; \ x >>= n |