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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/core/SkOpts.cpp ('k') | src/opts/SkOpts_neon.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkFloatingPoint_opts_DEFINED
9 #define SkFloatingPoint_opts_DEFINED
10
11 #include "SkFloatingPoint.h"
12
13 namespace SK_OPTS_NS {
14
15 #if defined(SK_ARM_HAS_NEON)
16 static float rsqrt(float x) {
17 return sk_float_rsqrt(x); // This sk_float_rsqrt copy will take the NEO N compile-time path.
18 }
19 #else
20 static float rsqrt(float x) {
21 // Get initial estimate.
22 int i = *SkTCast<int*>(&x);
23 i = 0x5F1FFFF9 - (i>>1);
24 float estimate = *SkTCast<float*>(&i);
25
26 // One step of Newton's method to refine.
27 const float estimate_sq = estimate*estimate;
28 estimate *= 0.703952253f*(2.38924456f-x*estimate_sq);
29 return estimate;
30 }
31 #endif
32
33 } // namespace SK_OPTS_NS
34
35 #endif//SkFloatingPoint_opts_DEFINED
OLDNEW
« 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