Chromium Code Reviews| 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; |
| } |