diff --git a/libavcodec/acelp_vectors.c b/libavcodec/acelp_vectors.c
index 0b478b787b9b0e2748c80b1936a3bf02877b0248..c9a6f408397b5508448c28bac0f38ccfc6329c01 100644
--- a/libavcodec/acelp_vectors.c
+++ b/libavcodec/acelp_vectors.c
@@ -245,14 +245,12 @@ void ff_set_fixed_vector(float *out, const AMRFixed *in, float scale, int size)
     for (i=0; i < in->n; i++) {
         int x   = in->x[i];
         float y = in->y[i] * scale;
-        out[x] += y;
 
-        x += in->pitch_lag;
-        while (x < size) {
-            y *= in->pitch_fac;
+        do {
             out[x] += y;
+            y *= in->pitch_fac;
             x += in->pitch_lag;
-        }
+        } while (x < size);
     }
 }
 
@@ -262,12 +260,10 @@ void ff_clear_fixed_vector(float *out, const AMRFixed *in, int size)
 
     for (i=0; i < in->n; i++) {
         int x  = in->x[i];
-        out[x] = 0.0;
 
-        x += in->pitch_lag;
-        while (x < size) {
+        do {
             out[x] = 0.0;
             x += in->pitch_lag;
-        }
+        } while (x < size);
     }
 }