Prepare to convert various types to size_t.
This makes some behaviorally-invariant changes to make certain code that
currently only works correctly with signed types work safely regardless of the
signedness of the types in question. This is preparation for a future change
that will convert a variety of types to size_t.
There are also some formatting changes (e.g. converting "enum hack" usage to real consts) to make it simpler to just change "int" to "size_t" in the future to change the types of those constants.
BUG=none
R=andrew@webrtc.org, juberti@webrtc.org, kwiberg@webrtc.org
TBR=ajm
Review URL: https://codereview.webrtc.org/1174813003
Cr-Commit-Position: refs/heads/master@{#9413}
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/encode.c b/webrtc/modules/audio_coding/codecs/ilbc/encode.c
index 1d46eff..3de8425 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/encode.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/encode.c
@@ -48,7 +48,7 @@
IlbcEncoder *iLBCenc_inst /* (i/o) the general encoder
state */
){
- int n, meml_gotten, Nfor, Nback;
+ int n, meml_gotten, Nfor;
int16_t diff, start_pos;
int index;
int subcount, subframe;
@@ -379,15 +379,14 @@
/* backward prediction of subframes */
- Nback = iLBCbits_inst->startIdx-1;
-
- if( Nback > 0 ){
+ if (iLBCbits_inst->startIdx > 1) {
/* create reverse order vectors
(The decresidual does not need to be copied since it is
contained in the same vector as the residual)
*/
+ int Nback = iLBCbits_inst->startIdx - 1;
WebRtcSpl_MemCpyReversedOrder(&reverseResidual[Nback*SUBL-1], residual, Nback*SUBL);
/* setup memory */
@@ -425,11 +424,11 @@
if (iLBCenc_inst->section == 1)
{
start_count = 0;
- end_count = WEBRTC_SPL_MAX (2 - Nfor, 0);
+ end_count = (Nfor >= 2) ? 0 : (2 - NFor);
}
if (iLBCenc_inst->section == 2)
{
- start_count = WEBRTC_SPL_MAX (2 - Nfor, 0);
+ start_count = (Nfor >= 2) ? 0 : (2 - NFor);
end_count = Nback;
}
}