Changeset 138705 in webkit


Ignore:
Timestamp:
Jan 3, 2013 1:54:36 AM (11 years ago)
Author:
Simon Hausmann
Message:

[MinGW-w64] Centralize workaround for pow() implementation
https://bugs.webkit.org/show_bug.cgi?id=105925

Reviewed by Sam Weinig.

As suggested by Sam, move the MinGW-w64 workaround into MathExtras.h
away from the JSC usage.

Source/JavaScriptCore:

  • runtime/MathObject.cpp:

(JSC::mathPow):

Source/WTF:

  • wtf/MathExtras.h:

(wtf_pow):

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r138689 r138705  
     12013-01-02  Simon Hausmann  <simon.hausmann@digia.com>
     2
     3        [MinGW-w64] Centralize workaround for pow() implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=105925
     5
     6        Reviewed by Sam Weinig.
     7
     8        As suggested by Sam, move the MinGW-w64 workaround into MathExtras.h
     9        away from the JSC usage.
     10
     11        * runtime/MathObject.cpp:
     12        (JSC::mathPow):
     13
    1142013-01-02  Gavin Barraclough  <barraclough@apple.com>
    215
  • trunk/Source/JavaScriptCore/runtime/MathObject.cpp

    r137895 r138705  
    233233ALWAYS_INLINE double mathPow(double x, double y)
    234234{
    235 #if COMPILER(MINGW64)
    236     // MinGW-w64 has a custom implementation for pow.
    237     // This handles certain special cases that are different.
    238     if ((x == 0.0 || isinf(x)) && isfinite(y)) {
    239         double f;
    240         if (modf(y, &f) != 0.0)
    241             return ((x == 0.0) ^ (y > 0.0)) ? std::numeric_limits<double>::infinity() : 0.0;
    242     }
    243 
    244     if (x == 2.0) {
    245         int yInt = static_cast<int>(y);
    246         if (y == yInt)
    247             return ldexp(1.0, yInt);
    248     }
    249 #endif
    250 
    251235    return pow(x, y);
    252236}
  • trunk/Source/WTF/ChangeLog

    r138628 r138705  
     12013-01-02  Simon Hausmann  <simon.hausmann@digia.com>
     2
     3        [MinGW-w64] Centralize workaround for pow() implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=105925
     5
     6        Reviewed by Sam Weinig.
     7
     8        As suggested by Sam, move the MinGW-w64 workaround into MathExtras.h
     9        away from the JSC usage.
     10
     11        * wtf/MathExtras.h:
     12        (wtf_pow):
     13
    1142013-01-02  Adam Barth  <abarth@webkit.org>
    215
  • trunk/Source/WTF/wtf/MathExtras.h

    r130826 r138705  
    227227#endif // COMPILER(MSVC)
    228228
     229#if COMPILER(MINGW64)
     230inline double wtf_pow(double x, double y)
     231{
     232    // MinGW-w64 has a custom implementation for pow.
     233    // This handles certain special cases that are different.
     234    if ((x == 0.0 || isinf(x)) && isfinite(y)) {
     235        double f;
     236        if (modf(y, &f) != 0.0)
     237            return ((x == 0.0) ^ (y > 0.0)) ? std::numeric_limits<double>::infinity() : 0.0;
     238    }
     239
     240    if (x == 2.0) {
     241        int yInt = static_cast<int>(y);
     242        if (y == yInt)
     243            return ldexp(1.0, yInt);
     244    }
     245
     246    return pow(x, y);
     247}
     248#define pow(x, y) wtf_pow(x, y)
     249#endif // COMPILER(MINGW64)
     250
    229251inline double deg2rad(double d)  { return d * piDouble / 180.0; }
    230252inline double rad2deg(double r)  { return r * 180.0 / piDouble; }
Note: See TracChangeset for help on using the changeset viewer.