Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Unified Diff: webrtc/modules/audio_coding/neteq/audio_vector.h

Issue 2700633003: Further optimization of AudioVector::operator[] (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/neteq/audio_vector.h
diff --git a/webrtc/modules/audio_coding/neteq/audio_vector.h b/webrtc/modules/audio_coding/neteq/audio_vector.h
index 18ab95c46d717bdd04a1c0db0557a1d5f90f405a..9100ff896893ebd43e53b7dbb4cfede2f10b48e5 100644
--- a/webrtc/modules/audio_coding/neteq/audio_vector.h
+++ b/webrtc/modules/audio_coding/neteq/audio_vector.h
@@ -128,9 +128,8 @@ class AudioVector {
size_t begin_index,
size_t capacity) {
RTC_DCHECK_GE(begin_index + index, index); // Check for overflow.
- const size_t ix = begin_index + index >= capacity
- ? begin_index + index - capacity
- : begin_index + index;
+ const size_t ix =
+ begin_index + index - (begin_index + index >= capacity ? capacity : 0);
nisse-webrtc 2017/02/17 08:28:25 I'm guess the compiler can recognize (begin_index
kwiberg-webrtc 2017/02/17 09:43:23 Yes, I agree that is more readable. I don't like m
RTC_DCHECK_LT(ix, capacity);
return ix;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698