Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(722)

Unified Diff: src/opts/SkFloatingPoint_opts.h

Issue 1264423002: Reorganize to keep similar code together. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkOpts.cpp ('k') | src/opts/SkOpts_neon.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/opts/SkFloatingPoint_opts.h
diff --git a/src/opts/SkFloatingPoint_opts.h b/src/opts/SkFloatingPoint_opts.h
new file mode 100644
index 0000000000000000000000000000000000000000..8b6536ad7f18dab0e72c7472803fe63deab9d777
--- /dev/null
+++ b/src/opts/SkFloatingPoint_opts.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkFloatingPoint_opts_DEFINED
+#define SkFloatingPoint_opts_DEFINED
+
+#include "SkFloatingPoint.h"
+
+namespace SK_OPTS_NS {
+
+#if defined(SK_ARM_HAS_NEON)
+ static float rsqrt(float x) {
+ return sk_float_rsqrt(x); // This sk_float_rsqrt copy will take the NEON compile-time path.
+ }
+#else
+ static float rsqrt(float x) {
+ // Get initial estimate.
+ int i = *SkTCast<int*>(&x);
+ i = 0x5F1FFFF9 - (i>>1);
+ float estimate = *SkTCast<float*>(&i);
+
+ // One step of Newton's method to refine.
+ const float estimate_sq = estimate*estimate;
+ estimate *= 0.703952253f*(2.38924456f-x*estimate_sq);
+ return estimate;
+ }
+#endif
+
+} // namespace SK_OPTS_NS
+
+#endif//SkFloatingPoint_opts_DEFINED
« no previous file with comments | « src/core/SkOpts.cpp ('k') | src/opts/SkOpts_neon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698