diff options
author | 2017-09-18 09:46:16 -0400 | |
---|---|---|
committer | 2017-09-18 15:03:29 +0000 | |
commit | 7791b94dcd3b5c1c384bdcfc438d1dc9f42faf6c (patch) | |
tree | 06bbf82c328fb1fa80410a18e90a4d24b2b78998 /include/private/SkFloatingPoint.h | |
parent | 205a1267605f6d47855146dfa8f2eed4c4368bd8 (diff) |
expand on sk_double_to_float() comment
I want to make sure we've got our reasoning straight
as we start to use this more.
Change-Id: I64b8351549a59e118f564e8505d42a0a620449c1
Reviewed-on: https://skia-review.googlesource.com/47840
Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Commit-Queue: Ben Wagner <benjaminwagner@google.com>
Diffstat (limited to 'include/private/SkFloatingPoint.h')
-rw-r--r-- | include/private/SkFloatingPoint.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/private/SkFloatingPoint.h b/include/private/SkFloatingPoint.h index d167bf6ef2..a131726d75 100644 --- a/include/private/SkFloatingPoint.h +++ b/include/private/SkFloatingPoint.h @@ -105,7 +105,9 @@ static inline int sk_float_saturate2int(float x) { #define sk_double_round2int(x) (int)floor((x) + 0.5f) #define sk_double_ceil2int(x) (int)ceil(x) -// Cast double to float, ignoring any warning about finite values being cast to infinity. +// Cast double to float, ignoring any warning about too-large finite values being cast to float. +// Clang thinks this is undefined, but it's actually implementation defined to return either +// the largest float or infinity (one of the two bracketing representable floats). Good enough! #if defined(__clang__) __attribute__((no_sanitize("float-cast-overflow"))) #endif |