OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 return log(num) / 0.693147180559945309417232121458176568; | 106 return log(num) / 0.693147180559945309417232121458176568; |
107 } | 107 } |
108 | 108 |
109 inline float log2f(float num) | 109 inline float log2f(float num) |
110 { | 110 { |
111 // This constant is roughly M_LN2, which is not provided by default on Windo
ws and Android. | 111 // This constant is roughly M_LN2, which is not provided by default on Windo
ws and Android. |
112 return logf(num) / 0.693147180559945309417232121458176568f; | 112 return logf(num) / 0.693147180559945309417232121458176568f; |
113 } | 113 } |
114 #endif | 114 #endif |
115 | 115 |
116 #if COMPILER(MSVC) | 116 #if COMPILER(MSVC) && (_MSC_VER < 1800) |
117 | 117 |
118 namespace std { | 118 namespace std { |
119 | 119 |
120 inline bool isinf(double num) { return !_finite(num) && !_isnan(num); } | 120 inline bool isinf(double num) { return !_finite(num) && !_isnan(num); } |
121 inline bool isnan(double num) { return !!_isnan(num); } | 121 inline bool isnan(double num) { return !!_isnan(num); } |
122 inline bool isfinite(double x) { return _finite(x); } | 122 inline bool isfinite(double x) { return _finite(x); } |
123 inline bool signbit(double num) { return _copysign(1.0, num) < 0; } | 123 inline bool signbit(double num) { return _copysign(1.0, num) < 0; } |
124 | 124 |
125 } // namespace std | 125 } // namespace std |
126 | 126 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 if (i >> 2) | 306 if (i >> 2) |
307 log2 += 2, i >>= 2; | 307 log2 += 2, i >>= 2; |
308 if (i >> 1) | 308 if (i >> 1) |
309 log2 += 1; | 309 log2 += 1; |
310 return log2; | 310 return log2; |
311 } | 311 } |
312 | 312 |
313 } // namespace WTF | 313 } // namespace WTF |
314 | 314 |
315 #endif // #ifndef WTF_MathExtras_h | 315 #endif // #ifndef WTF_MathExtras_h |
OLD | NEW |