[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Tue Apr 5 19:27:32 CEST 2005


CVS commit by staikos: 

tightening the loop (more to come)


  M +11 -7     kstrvector.cpp   1.86


--- kdeextragear-2/kst/kst/kstrvector.cpp  #1.85:1.86
@@ -436,5 +436,5 @@ KstObject::UpdateType KstRVector::update
 
 KstObject::UpdateType KstRVector::doUpdate(bool force) {
-  int i, j, k, shift, n_read=0;
+  int i, k, shift, n_read=0;
   int ave_nread;
   int new_f0, new_nf, tmp_fn;
@@ -539,10 +539,11 @@ KstObject::UpdateType KstRVector::doUpda
       /** read each sample from the File */
       //kdDebug() << "NF = " << NF << " numsamples = " << _numSamples << " new_f0 = " << new_f0 << endl;
-      // FIXME: tighten this loop.  Split out DoAve and non-DoAve cases, and
+      // FIXME: tighten this loop.
       //        precalculate new_nf to be small enough so that we don't have to
       //        constantly check (new_nf - i) >= Skip
       //        Also eliminate j?
-      for (i = NF, j = 0; i < new_nf && (new_nf - i) >= Skip; i += Skip, j++) {
+      double *t = _v + _numSamples;
         if (DoAve) {
+        for (i = NF; i < new_nf && (new_nf - i) >= Skip; i += Skip) {
           /* enlarge AveReadBuf if necessary */
           if (N_AveReadBuf < Skip*SPF) {
@@ -558,10 +559,13 @@ KstObject::UpdateType KstRVector::doUpda
           }
           if (ave_nread > 0) {
-            _v[_numSamples + j] = AveReadBuf[0]/double(ave_nread);
+            *t = AveReadBuf[0]/double(ave_nread);
             n_read++;
           }
+          ++t;
+        }
         } else {
+        for (i = NF; i < new_nf && (new_nf - i) >= Skip; i += Skip) {
           //kdDebug() << "readField " << _field << " start=" << new_f0 + i << " n=-1" << endl;
-          n_read += _file->readField(_v + _numSamples + j, _field, new_f0 + i, -1);
+          n_read += _file->readField(t++, _field, new_f0 + i, -1);
         }
       }




More information about the Kst mailing list