Index: src/core/Sk4x_portable.h |
diff --git a/src/core/Sk4x_portable.h b/src/core/Sk4x_portable.h |
index bd056c777eef682dc8b01df1fec6c9f16fcf7976..440e91faaa581b87a0d5441256bc62c0fe88538f 100644 |
--- a/src/core/Sk4x_portable.h |
+++ b/src/core/Sk4x_portable.h |
@@ -2,6 +2,8 @@ |
// This file will be intentionally included three times. |
#if defined(SK4X_PREAMBLE) |
+ #include "SkFloatingPoint.h" |
+ #include <math.h> |
#elif defined(SK4X_PRIVATE) |
typedef T Type; |
@@ -60,6 +62,20 @@ M(Sk4x<T>) multiply(const Sk4x<T>& other) const { return Sk4x(BINOP(*)); } |
M(Sk4x<T>) divide(const Sk4x<T>& other) const { return Sk4x(BINOP(/)); } |
#undef BINOP |
+template<> inline Sk4f Sk4f::rsqrt() const { |
+ return Sk4f(sk_float_rsqrt(fVec[0]), |
+ sk_float_rsqrt(fVec[1]), |
+ sk_float_rsqrt(fVec[2]), |
+ sk_float_rsqrt(fVec[3])); |
+} |
+ |
+template<> inline Sk4f Sk4f::sqrt() const { |
+ return Sk4f(sqrtf(fVec[0]), |
+ sqrtf(fVec[1]), |
+ sqrtf(fVec[2]), |
+ sqrtf(fVec[3])); |
+} |
+ |
#define BOOL_BINOP(op) fVec[0] op other.fVec[0] ? -1 : 0, \ |
fVec[1] op other.fVec[1] ? -1 : 0, \ |
fVec[2] op other.fVec[2] ? -1 : 0, \ |