[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Tue Apr 5 19:35:47 CEST 2005


CVS commit by staikos: 

final optimization - reorder the comparison and factor out a subtraction.


  M +3 -5      kstrvector.cpp   1.88


--- kdeextragear-2/kst/kst/kstrvector.cpp  #1.87:1.88
@@ -539,10 +539,8 @@ KstObject::UpdateType KstRVector::doUpda
       /** read each sample from the File */
       //kdDebug() << "NF = " << NF << " numsamples = " << _numSamples << " new_f0 = " << new_f0 << endl;
-      // FIXME: tighten this loop.
-      //        precalculate new_nf to be small enough so that we don't have to
-      //        constantly check (new_nf - i) >= Skip
       double *t = _v + _numSamples;
+      int new_nf_Skip = new_nf - Skip;
       if (DoAve) {
-        for (i = NF; (new_nf - i) >= Skip; i += Skip) {
+        for (i = NF; new_nf_Skip >= i; i += Skip) {
           /* enlarge AveReadBuf if necessary */
           if (N_AveReadBuf < Skip*SPF) {
@@ -564,5 +562,5 @@ KstObject::UpdateType KstRVector::doUpda
         }
       } else {
-        for (i = NF; (new_nf - i) >= Skip; i += Skip) {
+        for (i = NF; new_nf_Skip >= i; i += Skip) {
           //kdDebug() << "readField " << _field << " start=" << new_f0 + i << " n=-1" << endl;
           n_read += _file->readField(t++, _field, new_f0 + i, -1);




More information about the Kst mailing list