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

Side by Side Diff: include/core/SkFloatingPoint.h

Issue 576023003: Clarify build test for presense of 'float copysign(float, float)'. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13 matching lines...) Expand all
24 24
25 // C++98 cmath std::pow seems to be the earliest portable way to get float pow. 25 // C++98 cmath std::pow seems to be the earliest portable way to get float pow.
26 // However, on Linux including cmath undefines isfinite. 26 // However, on Linux including cmath undefines isfinite.
27 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14608 27 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14608
28 static inline float sk_float_pow(float base, float exp) { 28 static inline float sk_float_pow(float base, float exp) {
29 return powf(base, exp); 29 return powf(base, exp);
30 } 30 }
31 31
32 static inline float sk_float_copysign(float x, float y) { 32 static inline float sk_float_copysign(float x, float y) {
33 // c++11 contains a 'float copysign(float, float)' function in <cmath>. 33 // c++11 contains a 'float copysign(float, float)' function in <cmath>.
34 #if (!defined(_MSC_VER) && __cplusplus >= 201103L) || (defined(_MSC_VER) && _MSC _VER >= 1800) 34 // clang-cl reports __cplusplus for clang, not the __cplusplus vc++ version _MSC _VER would report.
35 #define SK_BUILD_WITH_CLANG_CL (defined(_MSC_VER) && defined(__clang__))
36 #if (!SK_BUILD_WITH_CLANG_CL && __cplusplus >= 201103L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
35 return copysign(x, y); 37 return copysign(x, y);
36 38
37 // Posix has demanded 'float copysignf(float, float)' (from C99) since Issue 6. 39 // Posix has demanded 'float copysignf(float, float)' (from C99) since Issue 6.
38 #elif defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L 40 #elif defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L
39 return copysignf(x, y); 41 return copysignf(x, y);
40 42
41 // Visual studio prior to 13 only has 'double _copysign(double, double)'. 43 // Visual studio prior to 13 only has 'double _copysign(double, double)'.
42 #elif defined(_MSC_VER) 44 #elif defined(_MSC_VER)
43 return (float)_copysign(x, y); 45 return (float)_copysign(x, y);
44 46
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 float estimate = *SkTCast<float*>(&i); 154 float estimate = *SkTCast<float*>(&i);
153 155
154 // One step of Newton's method to refine. 156 // One step of Newton's method to refine.
155 const float estimate_sq = estimate*estimate; 157 const float estimate_sq = estimate*estimate;
156 estimate *= (1.5f-0.5f*x*estimate_sq); 158 estimate *= (1.5f-0.5f*x*estimate_sq);
157 return estimate; 159 return estimate;
158 #endif 160 #endif
159 } 161 }
160 162
161 #endif 163 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698