Reformat the WebRTC code base
Running clang-format with chromium's style guide. The goal is n-fold: * providing consistency and readability (that's what code guidelines are for) * preventing noise with presubmit checks and git cl format * building on the previous point: making it easier to automatically fix format issues * you name it Please consider using git-hyper-blame to ignore this commit. Bug: webrtc:9340 Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87 Reviewed-on: https://webrtc-review.googlesource.com/81185 Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23660}
This commit is contained in:
@ -23,23 +23,17 @@ namespace rtc {
|
||||
// over N most recent samples.
|
||||
//
|
||||
// T is assumed to be an int, long, double or float.
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
class RollingAccumulator {
|
||||
public:
|
||||
explicit RollingAccumulator(size_t max_count)
|
||||
: samples_(max_count) {
|
||||
explicit RollingAccumulator(size_t max_count) : samples_(max_count) {
|
||||
Reset();
|
||||
}
|
||||
~RollingAccumulator() {
|
||||
}
|
||||
~RollingAccumulator() {}
|
||||
|
||||
size_t max_count() const {
|
||||
return samples_.size();
|
||||
}
|
||||
size_t max_count() const { return samples_.size(); }
|
||||
|
||||
size_t count() const {
|
||||
return count_;
|
||||
}
|
||||
size_t count() const { return count_; }
|
||||
|
||||
void Reset() {
|
||||
count_ = 0U;
|
||||
@ -84,9 +78,7 @@ class RollingAccumulator {
|
||||
next_index_ = (next_index_ + 1) % max_count();
|
||||
}
|
||||
|
||||
T ComputeSum() const {
|
||||
return static_cast<T>(sum_);
|
||||
}
|
||||
T ComputeSum() const { return static_cast<T>(sum_); }
|
||||
|
||||
double ComputeMean() const {
|
||||
if (count_ == 0) {
|
||||
@ -97,8 +89,8 @@ class RollingAccumulator {
|
||||
|
||||
T ComputeMax() const {
|
||||
if (max_stale_) {
|
||||
RTC_DCHECK(count_ > 0) <<
|
||||
"It shouldn't be possible for max_stale_ && count_ == 0";
|
||||
RTC_DCHECK(count_ > 0)
|
||||
<< "It shouldn't be possible for max_stale_ && count_ == 0";
|
||||
max_ = samples_[next_index_];
|
||||
for (size_t i = 1u; i < count_; i++) {
|
||||
max_ = std::max(max_, samples_[(next_index_ + i) % max_count()]);
|
||||
@ -110,8 +102,8 @@ class RollingAccumulator {
|
||||
|
||||
T ComputeMin() const {
|
||||
if (min_stale_) {
|
||||
RTC_DCHECK(count_ > 0) <<
|
||||
"It shouldn't be possible for min_stale_ && count_ == 0";
|
||||
RTC_DCHECK(count_ > 0)
|
||||
<< "It shouldn't be possible for min_stale_ && count_ == 0";
|
||||
min_ = samples_[next_index_];
|
||||
for (size_t i = 1u; i < count_; i++) {
|
||||
min_ = std::min(min_, samples_[(next_index_ + i) % max_count()]);
|
||||
|
||||
Reference in New Issue
Block a user