dca: fix signed overflow in shift
authorMans Rullgard <mans@mansr.com>
Sat, 8 Oct 2011 12:49:42 +0000 (13:49 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 4 Nov 2011 00:00:04 +0000 (01:00 +0100)
Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 559c244d42be7a02c23976216b47fd63b80d6c7f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/dca.c

index 69df8f4..24153eb 100644 (file)
@@ -905,7 +905,8 @@ static void qmf_32_subbands(DCAContext * s, int chans,
     for (subindex = 0; subindex < 8; subindex++) {
         /* Load in one sample from each subband and clear inactive subbands */
         for (i = 0; i < sb_act; i++){
-            uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ ((i-1)&2)<<30;
+            unsigned sign = (i - 1) & 2;
+            uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ sign << 30;
             AV_WN32A(&s->raXin[i], v);
         }