gcc isn't smart enough to factor out duplicate stores
authorLoren Merritt <lorenm@u.washington.edu>
Sat, 29 Sep 2007 01:54:25 +0000 (01:54 +0000)
committerLoren Merritt <lorenm@u.washington.edu>
Sat, 29 Sep 2007 01:54:25 +0000 (01:54 +0000)
Originally committed as revision 10611 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/flacenc.c

index b2b3c84..e997bca 100644 (file)
@@ -499,10 +499,11 @@ static void calc_sums(int pmin, int pmax, uint32_t *data, int n, int pred_order,
     res = &data[pred_order];
     res_end = &data[n >> pmax];
     for(i=0; i<parts; i++) {
-        sums[pmax][i] = 0;
+        uint32_t sum = 0;
         while(res < res_end){
-            sums[pmax][i] += *(res++);
+            sum += *(res++);
         }
+        sums[pmax][i] = sum;
         res_end+= n >> pmax;
     }
     /* sums for lower levels */