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

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

Issue 2670643007: Make AudioVector::operator[] inline and modify index calculation (Closed)
Patch Set: Created 3 years, 11 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 | webrtc/modules/audio_coding/neteq/audio_vector.cc » ('j') | 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 756292aa783aabd0449bfd76d61a20ade77dca85..c8722517dd604a598abb6f6b3a5f4454720c78df 100644
--- a/webrtc/modules/audio_coding/neteq/audio_vector.h
+++ b/webrtc/modules/audio_coding/neteq/audio_vector.h
@@ -110,8 +110,13 @@ class AudioVector {
virtual bool Empty() const;
// Accesses and modifies an element of AudioVector.
- const int16_t& operator[](size_t index) const;
- int16_t& operator[](size_t index);
+ inline const int16_t& operator[](size_t index) const {
kwiberg-webrtc 2017/02/07 14:04:15 The "inline" keyword isn't necessary---functions d
+ return array_[(begin_index_ + index) % capacity_];
the sun 2017/02/02 19:29:55 Integer division is still surprisingly expensive o
kwiberg-webrtc 2017/02/07 14:04:15 Alternatively, can we be sure that 0 <= begin_inde
hlundin-webrtc 2017/02/13 14:21:13 I did something along those lines.
+ }
+
+ inline int16_t& operator[](size_t index) {
+ return array_[(begin_index_ + index) % capacity_];
+ }
private:
static const size_t kDefaultInitialSize = 10;
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/neteq/audio_vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698