| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 const double piOverTwoDouble = M_PI_2; | 47 const double piOverTwoDouble = M_PI_2; |
| 48 const float piOverTwoFloat = static_cast<float>(M_PI_2); | 48 const float piOverTwoFloat = static_cast<float>(M_PI_2); |
| 49 | 49 |
| 50 const double piOverFourDouble = M_PI_4; | 50 const double piOverFourDouble = M_PI_4; |
| 51 const float piOverFourFloat = static_cast<float>(M_PI_4); | 51 const float piOverFourFloat = static_cast<float>(M_PI_4); |
| 52 | 52 |
| 53 const double twoPiDouble = piDouble * 2.0; | 53 const double twoPiDouble = piDouble * 2.0; |
| 54 const float twoPiFloat = piFloat * 2.0f; | 54 const float twoPiFloat = piFloat * 2.0f; |
| 55 | 55 |
| 56 #if OS(OPENBSD) | |
| 57 | |
| 58 namespace std { | |
| 59 | |
| 60 #ifndef isfinite | |
| 61 inline bool isfinite(double x) { return finite(x); } | |
| 62 #endif | |
| 63 #ifndef signbit | |
| 64 inline bool signbit(double x) { struct ieee_double *p = (struct ieee_double *)&x
; return p->dbl_sign; } | |
| 65 #endif | |
| 66 | |
| 67 } // namespace std | |
| 68 | |
| 69 #endif | |
| 70 | |
| 71 #if OS(ANDROID) || COMPILER(MSVC) | 56 #if OS(ANDROID) || COMPILER(MSVC) |
| 72 // ANDROID and MSVC's math.h does not currently supply log2 or log2f. | 57 // ANDROID and MSVC's math.h does not currently supply log2 or log2f. |
| 73 inline double log2(double num) | 58 inline double log2(double num) |
| 74 { | 59 { |
| 75 // This constant is roughly M_LN2, which is not provided by default on Windo
ws and Android. | 60 // This constant is roughly M_LN2, which is not provided by default on Windo
ws and Android. |
| 76 return log(num) / 0.693147180559945309417232121458176568; | 61 return log(num) / 0.693147180559945309417232121458176568; |
| 77 } | 62 } |
| 78 | 63 |
| 79 inline float log2f(float num) | 64 inline float log2f(float num) |
| 80 { | 65 { |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 if (i >> 2) | 336 if (i >> 2) |
| 352 log2 += 2, i >>= 2; | 337 log2 += 2, i >>= 2; |
| 353 if (i >> 1) | 338 if (i >> 1) |
| 354 log2 += 1; | 339 log2 += 1; |
| 355 return log2; | 340 return log2; |
| 356 } | 341 } |
| 357 | 342 |
| 358 } // namespace WTF | 343 } // namespace WTF |
| 359 | 344 |
| 360 #endif // #ifndef WTF_MathExtras_h | 345 #endif // #ifndef WTF_MathExtras_h |
| OLD | NEW |