diff options
author | Mike Reed <reed@google.com> | 2018-02-12 11:46:19 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-12 19:04:19 +0000 |
commit | faffa867716049c6b983312f034f6b54e3bccddc (patch) | |
tree | 2ec0b3ec4ab81d3bc675279735429b85a1bb7143 /include/private | |
parent | 154771b4dccff130d246c6b067129bafd64afb1a (diff) |
begin to wrap all float divides
Bug: skia:7607 skia:6134
Change-Id: Id126e92816bef1df1372bd531238cda9f3b36fab
Reviewed-on: https://skia-review.googlesource.com/106261
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include/private')
-rw-r--r-- | include/private/SkFloatingPoint.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/private/SkFloatingPoint.h b/include/private/SkFloatingPoint.h index bbb117982f..a2e6ee5122 100644 --- a/include/private/SkFloatingPoint.h +++ b/include/private/SkFloatingPoint.h @@ -190,4 +190,14 @@ static inline float sk_float_rsqrt(float x) { #define SK_FLT_DECIMAL_DIG 9 #endif +// IEEE defines how float divide behaves for non-finite values and zero-denoms, but C does not +// so we have a helper that suppresses the possible undefined-behavior warnings. + +#ifdef __clang__ +__attribute__((no_sanitize("float-divide-by-zero"))) +#endif +static inline float sk_ieee_float_divide(float numer, float denom) { + return numer / denom; +} + #endif |