OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkFloatingPoint_DEFINED | 10 #ifndef SkFloatingPoint_DEFINED |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // One step of Newton's method to refine. | 151 // One step of Newton's method to refine. |
152 const float32x2_t estimate_sq = vmul_f32(estimate, estimate); | 152 const float32x2_t estimate_sq = vmul_f32(estimate, estimate); |
153 estimate = vmul_f32(estimate, vrsqrts_f32(xx, estimate_sq)); | 153 estimate = vmul_f32(estimate, vrsqrts_f32(xx, estimate_sq)); |
154 return vget_lane_f32(estimate, 0); // 1 will work fine too; the answer's in
both places. | 154 return vget_lane_f32(estimate, 0); // 1 will work fine too; the answer's in
both places. |
155 #else | 155 #else |
156 // Perhaps runtime-detected NEON, or a portable fallback. | 156 // Perhaps runtime-detected NEON, or a portable fallback. |
157 return SkOpts::rsqrt(x); | 157 return SkOpts::rsqrt(x); |
158 #endif | 158 #endif |
159 } | 159 } |
160 | 160 |
161 // This is the number of significant digits we can print in a string such that w
hen we read that | |
162 // string back we get the floating point number we expect. The minimum value C
requires is 6, but | |
163 // most compilers support 9 | |
164 #ifdef FLT_DECIMAL_DIG | |
165 #define SK_FLT_DECIMAL_DIG FLT_DECIMAL_DIG | |
166 #else | |
167 #define SK_FLT_DECIMAL_DIG 9 | |
168 #endif | 161 #endif |
169 | |
170 #endif | |
OLD | NEW |