Title: [96780] trunk/Source
Revision
96780
Author
crog...@google.com
Date
2011-10-05 19:04:19 -0700 (Wed, 05 Oct 2011)

Log Message

Define a log2f() function for Windows in wtf/MathExtras.h
https://bugs.webkit.org/show_bug.cgi?id=69491

Reviewed by Darin Adler.

Source/_javascript_Core:

* wtf/MathExtras.h:
(log2f):

Source/WebCore:

No new tests. This change is tested in existing layout tests.

* webaudio/AudioParamTimeline.cpp:
(WebCore::AudioParamTimeline::valuesForTimeRangeImpl):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (96779 => 96780)


--- trunk/Source/_javascript_Core/ChangeLog	2011-10-06 01:40:05 UTC (rev 96779)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-10-06 02:04:19 UTC (rev 96780)
@@ -1,3 +1,13 @@
+2011-10-05  Chris Rogers  <crog...@google.com>
+
+        Define a log2f() function for Windows in wtf/MathExtras.h
+        https://bugs.webkit.org/show_bug.cgi?id=69491
+
+        Reviewed by Darin Adler.
+
+        * wtf/MathExtras.h:
+        (log2f):
+
 2011-10-05  Jer Noble  <jer.no...@apple.com>
 
         Enable WEB_AUDIO by default in the WebKit/mac port.

Modified: trunk/Source/_javascript_Core/wtf/MathExtras.h (96779 => 96780)


--- trunk/Source/_javascript_Core/wtf/MathExtras.h	2011-10-06 01:40:05 UTC (rev 96779)
+++ trunk/Source/_javascript_Core/wtf/MathExtras.h	2011-10-06 02:04:19 UTC (rev 96780)
@@ -149,13 +149,19 @@
 inline double copysign(double x, double y) { return _copysign(x, y); }
 inline int isfinite(double x) { return _finite(x); }
 
-// MSVC's math.h does not currently supply log2.
+// MSVC's math.h does not currently supply log2 or log2f.
 inline double log2(double num)
 {
     // This constant is roughly M_LN2, which is not provided by default on Windows.
     return log(num) / 0.693147180559945309417232121458176568;
 }
 
+inline float log2f(float num)
+{
+    // This constant is roughly M_LN2, which is not provided by default on Windows.
+    return logf(num) / 0.693147180559945309417232121458176568f;
+}
+
 // Work around a bug in Win, where atan2(+-infinity, +-infinity) yields NaN instead of specific values.
 inline double wtf_atan2(double x, double y)
 {

Modified: trunk/Source/WebCore/ChangeLog (96779 => 96780)


--- trunk/Source/WebCore/ChangeLog	2011-10-06 01:40:05 UTC (rev 96779)
+++ trunk/Source/WebCore/ChangeLog	2011-10-06 02:04:19 UTC (rev 96780)
@@ -1,3 +1,15 @@
+2011-10-05  Chris Rogers  <crog...@google.com>
+
+        Define a log2f() function for Windows in wtf/MathExtras.h
+        https://bugs.webkit.org/show_bug.cgi?id=69491
+
+        Reviewed by Darin Adler.
+
+        No new tests. This change is tested in existing layout tests.
+
+        * webaudio/AudioParamTimeline.cpp:
+        (WebCore::AudioParamTimeline::valuesForTimeRangeImpl):
+
 2011-10-05  Erik Arvidsson  <a...@chromium.org>
 
         window.location.href and others needlessly decodes URI-encoded characters

Modified: trunk/Source/WebCore/webaudio/AudioParamTimeline.cpp (96779 => 96780)


--- trunk/Source/WebCore/webaudio/AudioParamTimeline.cpp	2011-10-06 01:40:05 UTC (rev 96779)
+++ trunk/Source/WebCore/webaudio/AudioParamTimeline.cpp	2011-10-06 02:04:19 UTC (rev 96780)
@@ -246,9 +246,8 @@
                     values[writeIndex] = value;
             } else {
                 // Interpolate in log space.
-                // FIXME: we should just use log2f(), but Windows doesn't have this function.
-                value1 = narrowPrecisionToFloat(log2(value1));
-                value2 = narrowPrecisionToFloat(log2(value2));
+                value1 = log2f(value1);
+                value2 = log2f(value2);
 
                 // FIXME: optimize to not use pow() in inner loop, this is just a simple exponential ramp.
                 for (; writeIndex < fillToFrame; ++writeIndex) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to