Making the multiplication in normalise_residual() produce a 32-bit result just
authorJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Tue, 20 Oct 2009 11:22:04 +0000 (07:22 -0400)
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Tue, 20 Oct 2009 11:22:04 +0000 (07:22 -0400)
to be on the safe side (not that I observed any overflow, but I can't prove
it can't happen).

libcelt/vq.c

index e05ab87..18de31b 100644 (file)
@@ -109,7 +109,7 @@ static void normalise_residual(int * restrict iy, celt_norm * restrict X, int N,
 
    i=0;
    do
-      X[i] = SHR16(MULT16_16_16(g, iy[i]),1);
+      X[i] = EXTRACT16(SHR32(MULT16_16(g, iy[i]),1));
    while (++i < N);
 }