common_audio refactoring: Removed macro WEBRTC_SPL_LSHIFT_U32

The macro is a trivial shift operator including a cast before shift. There is no guard against negative shifts. Replaced with << at place and added casts when necessary.

Affects both fixed and float point versions of iSAC

BUG=3348,3353
TESTED=locally on linux and trybots
R=kwiberg@webrtc.org, tina.legrand@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7320 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 21c5663..ba306ed 100644
--- a/webrtc/common_audio/signal_processing/include/signal_processing_library.h
+++ b/webrtc/common_audio/signal_processing/include/signal_processing_library.h
@@ -95,7 +95,6 @@
 #define WEBRTC_SPL_LSHIFT_W32(x, c)     ((x) << (c))
 
 #define WEBRTC_SPL_RSHIFT_U32(x, c)     ((uint32_t)(x) >> (c))
-#define WEBRTC_SPL_LSHIFT_U32(x, c)     ((uint32_t)(x) << (c))
 
 #define WEBRTC_SPL_RAND(a) \
     ((int16_t)(WEBRTC_SPL_MUL_16_16_RSFT((a), 18816, 7) & 0x00007fff))
diff --git a/webrtc/common_audio/signal_processing/signal_processing_unittest.cc b/webrtc/common_audio/signal_processing/signal_processing_unittest.cc
index 3fa3d2e..d5cc5f0 100644
--- a/webrtc/common_audio/signal_processing/signal_processing_unittest.cc
+++ b/webrtc/common_audio/signal_processing/signal_processing_unittest.cc
@@ -72,7 +72,6 @@
     EXPECT_EQ(32766, WEBRTC_SPL_LSHIFT_W32(a, 1));
 
     EXPECT_EQ(8191u, WEBRTC_SPL_RSHIFT_U32(a, 1));
-    EXPECT_EQ(32766u, WEBRTC_SPL_LSHIFT_U32(a, 1));
 
     EXPECT_EQ(1470, WEBRTC_SPL_RAND(A));
 
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routines_hist.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routines_hist.c
index 5311b39..2cc020d 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routines_hist.c
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routines_hist.c
@@ -310,7 +310,7 @@
   if (streamData->stream_index == 0)
   {
     /* read first word from bytestream */
-    streamval = WEBRTC_SPL_LSHIFT_U32(*streamPtr++, 16);
+    streamval = (uint32_t)(*streamPtr++) << 16;
     streamval |= *streamPtr++;
   } else {
     streamval = streamData->streamval;
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routines_logist.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routines_logist.c
index 4efdecc..5133128 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routines_logist.c
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routines_logist.c
@@ -184,21 +184,20 @@
      * W_upper < 2^24 */
     while ( !(W_upper & 0xFF000000) )
     {
-      W_upper = WEBRTC_SPL_LSHIFT_U32(W_upper, 8);
+      W_upper <<= 8;
       if (streamData->full == 0) {
         *streamPtr++ += (uint16_t) WEBRTC_SPL_RSHIFT_U32(
             streamData->streamval, 24);
         streamData->full = 1;
       } else {
-        *streamPtr = (uint16_t) WEBRTC_SPL_LSHIFT_U32(
-            WEBRTC_SPL_RSHIFT_U32(streamData->streamval, 24), 8);
+        *streamPtr = (uint16_t)((streamData->streamval >> 24) << 8);
         streamData->full = 0;
       }
 
       if( streamPtr > maxStreamPtr )
         return -ISAC_DISALLOWED_BITSTREAM_LENGTH;
 
-      streamData->streamval = WEBRTC_SPL_LSHIFT_U32(streamData->streamval, 8);
+      streamData->streamval <<= 8;
     }
   }
 
@@ -257,7 +256,7 @@
   if (streamData->stream_index == 0)
   {
     /* read first word from bytestream */
-    streamVal = WEBRTC_SPL_LSHIFT_U32(*streamPtr++, 16);
+    streamVal = (uint32_t)(*streamPtr++) << 16;
     streamVal |= *streamPtr++;
 
   } else {
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.c
index d28a6f7..e69435f 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.c
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.c
@@ -523,9 +523,9 @@
       bweStr->recBw = (int32_t) MIN_ISAC_BW;
     }
 
-    bweStr->recBwAvg = WEBRTC_SPL_LSHIFT_U32(bweStr->recBw + bweStr->recHeaderRate, 5);
+    bweStr->recBwAvg = (bweStr->recBw + bweStr->recHeaderRate) << 5;
 
-    bweStr->recBwAvgQ = WEBRTC_SPL_LSHIFT_U32(bweStr->recBw, 7);
+    bweStr->recBwAvgQ = bweStr->recBw << 7;
 
     bweStr->recJitterShortTerm = 0;
 
@@ -573,8 +573,8 @@
 
   /* compute the BN estimate as decoded on the other side */
   /* sendBwAvg = 0.9 * sendBwAvg + 0.1 * kQRateTable[RateInd]; */
-  bweStr->sendBwAvg = WEBRTC_SPL_UMUL(461, bweStr->sendBwAvg) +
-      WEBRTC_SPL_UMUL(51, WEBRTC_SPL_LSHIFT_U32(kQRateTable[RateInd], 7));
+  bweStr->sendBwAvg = 461 * bweStr->sendBwAvg +
+      51 * ((uint32_t)kQRateTable[RateInd] << 7);
   bweStr->sendBwAvg = WEBRTC_SPL_RSHIFT_U32(bweStr->sendBwAvg, 9);
 
 
@@ -625,8 +625,8 @@
   /* Compute the averaged BN estimate on this side */
 
   /* recBwAvg = 0.9 * recBwAvg + 0.1 * (rate + bweStr->recHeaderRate), 0.9 and 0.1 in Q9 */
-  bweStr->recBwAvg = WEBRTC_SPL_UMUL(922, bweStr->recBwAvg) +
-      WEBRTC_SPL_UMUL(102, WEBRTC_SPL_LSHIFT_U32((uint32_t)rate + bweStr->recHeaderRate, 5));
+  bweStr->recBwAvg = 922 * bweStr->recBwAvg +
+      102 * (((uint32_t)rate + bweStr->recHeaderRate) << 5);
   bweStr->recBwAvg = WEBRTC_SPL_RSHIFT_U32(bweStr->recBwAvg, 10);
 
   /* Find quantization index that gives the closest rate after averaging.
diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/crc.c b/webrtc/modules/audio_coding/codecs/isac/main/source/crc.c
index 1d36ff0..06c15cb 100644
--- a/webrtc/modules/audio_coding/codecs/isac/main/source/crc.c
+++ b/webrtc/modules/audio_coding/codecs/isac/main/source/crc.c
@@ -102,7 +102,7 @@
   for (byte_cntr = 0; byte_cntr < len_bitstream_in_bytes; byte_cntr++) {
     crc_tbl_indx = (WEBRTC_SPL_RSHIFT_U32(crc_state, 24) ^
                        bitstream_ptr_uw8[byte_cntr]) & 0xFF;
-    crc_state = WEBRTC_SPL_LSHIFT_U32(crc_state, 8) ^ kCrcTable[crc_tbl_indx];
+    crc_state = (crc_state << 8) ^ kCrcTable[crc_tbl_indx];
   }
 
   *crc = ~crc_state;