Title: [268553] trunk/Source/WebCore
Revision
268553
Author
[email protected]
Date
2020-10-15 14:15:18 -0700 (Thu, 15 Oct 2020)

Log Message

Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues()
https://bugs.webkit.org/show_bug.cgi?id=217766

Reviewed by Geoffrey Garen.

Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues().

No new tests, no Web-facing behavior change.

* Modules/webaudio/AudioParam.cpp:
(WebCore::AudioParam::calculateFinalValues):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (268552 => 268553)


--- trunk/Source/WebCore/ChangeLog	2020-10-15 20:56:03 UTC (rev 268552)
+++ trunk/Source/WebCore/ChangeLog	2020-10-15 21:15:18 UTC (rev 268553)
@@ -1,3 +1,17 @@
+2020-10-15  Chris Dumez  <[email protected]>
+
+        Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues()
+        https://bugs.webkit.org/show_bug.cgi?id=217766
+
+        Reviewed by Geoffrey Garen.
+
+        Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues().
+
+        No new tests, no Web-facing behavior change.
+
+        * Modules/webaudio/AudioParam.cpp:
+        (WebCore::AudioParam::calculateFinalValues):
+
 2020-10-15  Wenson Hsieh  <[email protected]>
 
         Add a fast codepath to compute the bounding rect of an inline arc path

Modified: trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp (268552 => 268553)


--- trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp	2020-10-15 20:56:03 UTC (rev 268552)
+++ trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp	2020-10-15 21:15:18 UTC (rev 268553)
@@ -266,9 +266,7 @@
 
         if (timelineValue)
             m_value = *timelineValue;
-
-        for (unsigned i = 0; i < numberOfValues; ++i)
-            values[i] = m_value;
+        std::fill_n(values, numberOfValues, m_value);
     }
 
     if (!numberOfRenderingConnections())
@@ -294,10 +292,8 @@
     }
 
     // If we're not sample accurate, duplicate the first element of |values| to all of the elements.
-    if (!sampleAccurate) {
-        for (unsigned i = 1; i < numberOfValues; ++i)
-            values[i] = values[0];
-    }
+    if (!sampleAccurate)
+        std::fill_n(values + 1, numberOfValues - 1, values[0]);
 
     // Clamp values based on range allowed by AudioParam's min and max values.
     VectorMath::clamp(values, minValue(), maxValue(), values, numberOfValues);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to