Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Issue 2233853002: constexpr NaN,+Inf,-Inf (Closed)

Created:
4 years, 4 months ago by mtklein_C
Modified:
4 years, 4 months ago
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

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 Committed: https://skia.googlesource.com/skia/+/3ff2cc81a58b3fe5287980cf618147c84a6c81f6

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -14 lines) Patch
M include/private/SkFloatingPoint.h View 1 chunk +4 lines, -7 lines 0 comments Download
M src/core/SkLiteDL.cpp View 1 chunk +2 lines, -3 lines 0 comments Download
M src/core/SkMath.cpp View 1 chunk +0 lines, -4 lines 0 comments Download

Messages

Total messages: 15 (8 generated)
mtklein_C
4 years, 4 months ago (2016-08-10 13:32:43 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2233853002/1
4 years, 4 months ago (2016-08-10 13:32:57 UTC) #5
reed1
cary, do you remember why we deliberately put nan and inf in globals? Was it ...
4 years, 4 months ago (2016-08-10 14:29:06 UTC) #9
caryclark
On 2016/08/10 14:29:06, reed1 wrote: > cary, do you remember why we deliberately put nan ...
4 years, 4 months ago (2016-08-10 14:52:38 UTC) #10
reed1
dreek, brian -- anyone object to NOT using a global to access infinity/nan? For some ...
4 years, 4 months ago (2016-08-10 15:21:41 UTC) #12
reed1
after chat, brian can't remember either, so maybe whatever the issue was is now gone ...
4 years, 4 months ago (2016-08-10 15:29:24 UTC) #13
commit-bot: I haz the power
4 years, 4 months ago (2016-08-10 15:31:47 UTC) #15
Message was sent while issue was closed.
Committed patchset #1 (id:1) as
https://skia.googlesource.com/skia/+/3ff2cc81a58b3fe5287980cf618147c84a6c81f6

Powered by Google App Engine
This is Rietveld 408576698