Changeset 268553 in webkit


Ignore:
Timestamp:
Oct 15, 2020 2:15:18 PM (4 years ago)
Author:
Chris Dumez
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r268552 r268553  
     12020-10-15  Chris Dumez  <cdumez@apple.com>
     2
     3        Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues()
     4        https://bugs.webkit.org/show_bug.cgi?id=217766
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Use std::fill_n() instead of for loops in AudioParam::calculateFinalValues().
     9
     10        No new tests, no Web-facing behavior change.
     11
     12        * Modules/webaudio/AudioParam.cpp:
     13        (WebCore::AudioParam::calculateFinalValues):
     14
    1152020-10-15  Wenson Hsieh  <wenson_hsieh@apple.com>
    216
  • trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp

    r268414 r268553  
    267267        if (timelineValue)
    268268            m_value = *timelineValue;
    269 
    270         for (unsigned i = 0; i < numberOfValues; ++i)
    271             values[i] = m_value;
     269        std::fill_n(values, numberOfValues, m_value);
    272270    }
    273271
     
    295293
    296294    // If we're not sample accurate, duplicate the first element of |values| to all of the elements.
    297     if (!sampleAccurate) {
    298         for (unsigned i = 1; i < numberOfValues; ++i)
    299             values[i] = values[0];
    300     }
     295    if (!sampleAccurate)
     296        std::fill_n(values + 1, numberOfValues - 1, values[0]);
    301297
    302298    // Clamp values based on range allowed by AudioParam's min and max values.
Note: See TracChangeset for help on using the changeset viewer.