Index: include/core/SkMath.h |
diff --git a/include/core/SkMath.h b/include/core/SkMath.h |
index 078c8fccdc2206975c07ed830222fe82f7e710af..66df00f40813514fe347a41df418392276431986 100644 |
--- a/include/core/SkMath.h |
+++ b/include/core/SkMath.h |
@@ -173,4 +173,13 @@ static inline U8CPU SkMulDiv255Round(U16CPU a, U16CPU b) { |
return (prod + (prod >> 8)) >> 8; |
} |
+static inline float SkFloatInvSqrt(float x) { |
reed1
2013/08/12 14:05:54
Need dox for a public API
1. Should probably be r
Yang Gu
2013/08/13 03:33:31
We may add "fast" into name (e.g., SkFloatFastInvS
|
+ float xhalf = 0.5f * x; |
+ int i = *SkTCast<int*>(&x); |
+ i = 0x5f3759df - (i >> 1); |
+ x = *SkTCast<float*>(&i); |
+ x = x * (1.5f - xhalf * x * x); |
+ return x; |
+} |
+ |
#endif |