diff options
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkFloatingPoint.h | 7 | ||||
-rw-r--r-- | include/core/SkScalar.h | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/include/core/SkFloatingPoint.h b/include/core/SkFloatingPoint.h index 9f354fbfae..b3e490d604 100644 --- a/include/core/SkFloatingPoint.h +++ b/include/core/SkFloatingPoint.h @@ -16,10 +16,11 @@ #include <float.h> #include "SkFloatBits.h" -// If math.h had powf(float, float), I could remove this wrapper +// C++98 cmath std::pow seems to be the earliest portable way to get float pow. +// However, on Linux including cmath undefines isfinite. +// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14608 static inline float sk_float_pow(float base, float exp) { - return static_cast<float>(pow(static_cast<double>(base), - static_cast<double>(exp))); + return powf(base, exp); } static inline float sk_float_copysign(float x, float y) { diff --git a/include/core/SkScalar.h b/include/core/SkScalar.h index 5be18cb859..ed419689d8 100644 --- a/include/core/SkScalar.h +++ b/include/core/SkScalar.h @@ -182,6 +182,9 @@ /** Returns the square root of the SkScalar */ #define SkScalarSqrt(x) sk_float_sqrt(x) + /** Returns b to the e + */ + #define SkScalarPow(b, e) sk_float_pow(b, e) /** Returns the average of two SkScalars (a+b)/2 */ #define SkScalarAve(a, b) (((a) + (b)) * 0.5f) |