common_audio: Removes macro WEBRTC_SPL_LSHIFT_U16

We should avoid macros in general (see style guide) and the shift ones are particular dangerous since they assume that the user apply a non-negative shift.

Related CL: https://webrtc-codereview.appspot.com/16669004

BUG=3348,3353
TESTED=trybots and manually on linux
R=turaj@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/19719004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6444 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/common_audio/signal_processing/include/signal_processing_library.h b/webrtc/common_audio/signal_processing/include/signal_processing_library.h
index 69023b2..3a5d51c 100644
--- a/webrtc/common_audio/signal_processing/include/signal_processing_library.h
+++ b/webrtc/common_audio/signal_processing/include/signal_processing_library.h
@@ -123,7 +123,6 @@
 #define WEBRTC_SPL_RSHIFT_W32(x, c)     ((x) >> (c))
 #define WEBRTC_SPL_LSHIFT_W32(x, c)     ((x) << (c))
 
-#define WEBRTC_SPL_LSHIFT_U16(x, c)     ((uint16_t)(x) << (c))
 #define WEBRTC_SPL_RSHIFT_U32(x, c)     ((uint32_t)(x) >> (c))
 #define WEBRTC_SPL_LSHIFT_U32(x, c)     ((uint32_t)(x) << (c))
 
diff --git a/webrtc/common_audio/signal_processing/signal_processing_unittest.cc b/webrtc/common_audio/signal_processing/signal_processing_unittest.cc
index 48f6eb3..81ca369 100644
--- a/webrtc/common_audio/signal_processing/signal_processing_unittest.cc
+++ b/webrtc/common_audio/signal_processing/signal_processing_unittest.cc
@@ -89,7 +89,6 @@
     EXPECT_EQ(8191, WEBRTC_SPL_RSHIFT_W32(a, 1));
     EXPECT_EQ(32766, WEBRTC_SPL_LSHIFT_W32(a, 1));
 
-    EXPECT_EQ(32766, WEBRTC_SPL_LSHIFT_U16(a, 1));
     EXPECT_EQ(8191u, WEBRTC_SPL_RSHIFT_U32(a, 1));
     EXPECT_EQ(32766u, WEBRTC_SPL_LSHIFT_U32(a, 1));
 
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/encode.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/encode.c
index e209c0e..daf0d62 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/encode.c
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/encode.c
@@ -15,18 +15,21 @@
  *
  */
 
-#include "arith_routins.h"
-#include "bandwidth_estimator.h"
-#include "codec.h"
-#include "pitch_gain_tables.h"
-#include "pitch_lag_tables.h"
-#include "entropy_coding.h"
-#include "lpc_tables.h"
-#include "lpc_masking_model.h"
-#include "pitch_estimator.h"
-#include "structs.h"
+#include "webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h"
+
+#include <assert.h>
 #include <stdio.h>
 
+#include "webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routins.h"
+#include "webrtc/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.h"
+#include "webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h"
+#include "webrtc/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model.h"
+#include "webrtc/modules/audio_coding/codecs/isac/fix/source/lpc_tables.h"
+#include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.h"
+#include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_gain_tables.h"
+#include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_lag_tables.h"
+#include "webrtc/modules/audio_coding/codecs/isac/fix/source/structs.h"
+
 
 int WebRtcIsacfix_EncodeImpl(int16_t      *in,
                              ISACFIX_EncInst_t  *ISACenc_obj,
@@ -450,12 +453,14 @@
 
     while (stream_length < MinBytes)
     {
+      assert(stream_length >= 0);
       if (stream_length & 0x0001){
         ISACenc_obj->bitstr_seed = WEBRTC_SPL_RAND( ISACenc_obj->bitstr_seed );
         ISACenc_obj->bitstr_obj.stream[ WEBRTC_SPL_RSHIFT_W16(stream_length, 1) ] |= (uint16_t)(ISACenc_obj->bitstr_seed & 0xFF);
       } else {
         ISACenc_obj->bitstr_seed = WEBRTC_SPL_RAND( ISACenc_obj->bitstr_seed );
-        ISACenc_obj->bitstr_obj.stream[ WEBRTC_SPL_RSHIFT_W16(stream_length, 1) ] = WEBRTC_SPL_LSHIFT_U16(ISACenc_obj->bitstr_seed, 8);
+        ISACenc_obj->bitstr_obj.stream[stream_length / 2] =
+            ((uint16_t)ISACenc_obj->bitstr_seed << 8);
       }
       stream_length++;
     }
@@ -467,7 +472,8 @@
     }
     else {
       ISACenc_obj->bitstr_obj.stream[usefulstr_len>>1] &= 0x00FF;
-      ISACenc_obj->bitstr_obj.stream[usefulstr_len>>1] += WEBRTC_SPL_LSHIFT_U16((MinBytes - usefulstr_len) & 0x00FF, 8);
+      ISACenc_obj->bitstr_obj.stream[usefulstr_len >> 1] +=
+          ((uint16_t)((MinBytes - usefulstr_len) & 0x00FF) << 8);
     }
   }
   else
diff --git a/webrtc/modules/audio_processing/agc/digital_agc.c b/webrtc/modules/audio_processing/agc/digital_agc.c
index d3acc1f..4b169c1 100644
--- a/webrtc/modules/audio_processing/agc/digital_agc.c
+++ b/webrtc/modules/audio_processing/agc/digital_agc.c
@@ -773,7 +773,7 @@
     tmp16 = WEBRTC_SPL_LSHIFT_W16(3, 12);
     tmp32 = WEBRTC_SPL_MUL_16_16(tmp16, (dB - state->meanLongTerm));
     tmp32 = WebRtcSpl_DivW32W16(tmp32, state->stdLongTerm);
-    tmpU16 = WEBRTC_SPL_LSHIFT_U16((uint16_t)13, 12);
+    tmpU16 = (13 << 12);
     tmp32b = WEBRTC_SPL_MUL_16_U16(state->logRatio, tmpU16);
     tmp32 += WEBRTC_SPL_RSHIFT_W32(tmp32b, 10);
 
diff --git a/webrtc/modules/audio_processing/ns/nsx_core.c b/webrtc/modules/audio_processing/ns/nsx_core.c
index 4993321..2c8270f 100644
--- a/webrtc/modules/audio_processing/ns/nsx_core.c
+++ b/webrtc/modules/audio_processing/ns/nsx_core.c
@@ -1407,7 +1407,7 @@
     tmpU32no1 = WEBRTC_SPL_RSHIFT_U32((uint32_t)sum_log_i_log_magn, 12); // Q5
 
     // Shift the largest value of sum_log_i and tmp32no3 before multiplication
-    tmp_u16 = WEBRTC_SPL_LSHIFT_U16((uint16_t)sum_log_i, 1); // Q6
+    tmp_u16 = ((uint16_t)sum_log_i << 1);  // Q6
     if ((uint32_t)sum_log_i > tmpU32no1) {
       tmp_u16 >>= zeros;
     } else {