Commit 72f4f956 authored by Andrew Moylan's avatar Andrew Moylan Committed by Commit Bot

Replace if() with DCHECK re. arithmetic rounding

Per pkasting discussion in crrev.com/c/2318967, crrev.com/c/2328297 adds
a DCHECK enforcing divisibility of the constructor arguments that makes
this if() sure to be false. Replace with a DCHECK.

Bug: none
Change-Id: Iee2707ef7fa071f44c43c4fe02709a9f8829d4f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2328393Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Andrew Moylan <amoylan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#793060}
parent 485d080d
......@@ -84,10 +84,8 @@ int RecentEventsCounter::GetBucketIndex(base::TimeDelta timestamp) const {
DCHECK_GE(timestamp, base::TimeDelta());
int index = (timestamp % duration_) / bucket_duration_;
if (index >= num_buckets_) {
return num_buckets_ - 1;
}
DCHECK_GE(index, 0);
DCHECK_LT(index, num_buckets_);
return index;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment