[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Thu Oct 27 00:27:43 CEST 2005


SVN commit 474648 by staikos:

- remove redundancies
- I change my mind.  _size > 0 is a precondition and if that fails, then we
crash.  This is too performance critical for another if().


 M  +2 -14     kstvector.cpp  


--- trunk/extragear/graphics/kst/kst/kstvector.cpp #474647:474648
@@ -107,10 +107,6 @@
 
 #define GENERATE_INTERPOLATION              \
   assert(_size > 0);                        \
-  if (_size == 0) {                         \
-    return KST::NOPOINT;                    \
-  }                                         \
-                                            \
   /** Limits checks - optional? **/         \
   if (in_i < 0 || _size == 1) {             \
     return _v[0];                           \
@@ -129,17 +125,9 @@
                                             \
   int j = int(floor(fj)); /* index of sample one lower */ \
   assert(j+1 < _size && j >= 0);            \
-  /* This is optimized to avoid unnecessary isnan calls! */  \
-  if (_v[j + 1] != _v[j + 1]) {             \
-    if (KST_ISNAN(_v[j + 1])) {             \
-      return KST::NOPOINT;                  \
-    }                                       \
+  if (_v[j + 1] != _v[j + 1] || _v[j] != _v[j]) { \
+    return KST::NOPOINT;                    \
   }                                         \
-  if (_v[j] != _v[j]) {                     \
-    if (KST_ISNAN(_v[j])) {                 \
-      return KST::NOPOINT;                  \
-    }                                       \
-  }                                         \
                                             \
   double fdj = fj - float(j); /* fdj is fraction between _v[j] and _v[j+1] */ \
                                             \


More information about the Kst mailing list