Title: [138705] trunk/Source
Revision
138705
Author
hausm...@webkit.org
Date
2013-01-03 01:54:36 -0800 (Thu, 03 Jan 2013)

Log 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/_javascript_Core:

* runtime/MathObject.cpp:
(JSC::mathPow):

Source/WTF:

* wtf/MathExtras.h:
(wtf_pow):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (138704 => 138705)


--- trunk/Source/_javascript_Core/ChangeLog	2013-01-03 09:13:50 UTC (rev 138704)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-01-03 09:54:36 UTC (rev 138705)
@@ -1,3 +1,16 @@
+2013-01-02  Simon Hausmann  <simon.hausm...@digia.com>
+
+        [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.
+
+        * runtime/MathObject.cpp:
+        (JSC::mathPow):
+
 2013-01-02  Gavin Barraclough  <barraclo...@apple.com>
 
         Objective-C API for _javascript_Core

Modified: trunk/Source/_javascript_Core/runtime/MathObject.cpp (138704 => 138705)


--- trunk/Source/_javascript_Core/runtime/MathObject.cpp	2013-01-03 09:13:50 UTC (rev 138704)
+++ trunk/Source/_javascript_Core/runtime/MathObject.cpp	2013-01-03 09:54:36 UTC (rev 138705)
@@ -232,22 +232,6 @@
 
 ALWAYS_INLINE double mathPow(double x, double y)
 {
-#if COMPILER(MINGW64)
-    // MinGW-w64 has a custom implementation for pow.
-    // This handles certain special cases that are different.
-    if ((x == 0.0 || isinf(x)) && isfinite(y)) {
-        double f;
-        if (modf(y, &f) != 0.0)
-            return ((x == 0.0) ^ (y > 0.0)) ? std::numeric_limits<double>::infinity() : 0.0;
-    }
-
-    if (x == 2.0) {
-        int yInt = static_cast<int>(y);
-        if (y == yInt)
-            return ldexp(1.0, yInt);
-    }
-#endif
-
     return pow(x, y);
 }
 

Modified: trunk/Source/WTF/ChangeLog (138704 => 138705)


--- trunk/Source/WTF/ChangeLog	2013-01-03 09:13:50 UTC (rev 138704)
+++ trunk/Source/WTF/ChangeLog	2013-01-03 09:54:36 UTC (rev 138705)
@@ -1,3 +1,16 @@
+2013-01-02  Simon Hausmann  <simon.hausm...@digia.com>
+
+        [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.
+
+        * wtf/MathExtras.h:
+        (wtf_pow):
+
 2013-01-02  Adam Barth  <aba...@webkit.org>
 
         WTF.gypi lists Platform.h twice

Modified: trunk/Source/WTF/wtf/MathExtras.h (138704 => 138705)


--- trunk/Source/WTF/wtf/MathExtras.h	2013-01-03 09:13:50 UTC (rev 138704)
+++ trunk/Source/WTF/wtf/MathExtras.h	2013-01-03 09:54:36 UTC (rev 138705)
@@ -226,6 +226,28 @@
 
 #endif // COMPILER(MSVC)
 
+#if COMPILER(MINGW64)
+inline double wtf_pow(double x, double y)
+{
+    // MinGW-w64 has a custom implementation for pow.
+    // This handles certain special cases that are different.
+    if ((x == 0.0 || isinf(x)) && isfinite(y)) {
+        double f;
+        if (modf(y, &f) != 0.0)
+            return ((x == 0.0) ^ (y > 0.0)) ? std::numeric_limits<double>::infinity() : 0.0;
+    }
+
+    if (x == 2.0) {
+        int yInt = static_cast<int>(y);
+        if (y == yInt)
+            return ldexp(1.0, yInt);
+    }
+
+    return pow(x, y);
+}
+#define pow(x, y) wtf_pow(x, y)
+#endif // COMPILER(MINGW64)
+
 inline double deg2rad(double d)  { return d * piDouble / 180.0; }
 inline double rad2deg(double r)  { return r * 180.0 / piDouble; }
 inline double deg2grad(double d) { return d * 400.0 / 360.0; }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to