[vtk-developers] Deprecating vtkFastNumericConversion

David Gobbi david.gobbi at gmail.com
Wed Jun 22 13:14:33 EDT 2011


Hi All,

I'd like to remove vtkFastNumericConversion.h/.cxx.  This is an
obsolete file uses bit-tricks to accelerate float-to-int conversions
on old pentium processors (i.e. Pentium II and earlier, or any code
compiled for compatibility with such processors).  It has now become
irrelevant and, in my opinion, dangerous.

Of note is that:
1) It applies these "bit tricks" whenever compiled a 32-bit x86
processor, even though modern i386-family processors do not need them
2) On all other processors, it gives incorrect results!!!
3) It is only used in the ray cast volume mapper, as far as I've seen

The incorrect results I mentioned are as follows: whenever
VTK_USE_TRICK is not set, it falls back to this code:

int QuickFloor(double val)
  {
  return static_cast<int>(val);
  }

int SafeFloor(double val)
  {
  return static_cast<int>(val);
  }

In other words, on any non-i386 CPU, including x86_64, the results are
incorrect if "val" is negative.  So I would like to mark the whole
thing "LEGACY" for now, and remove the file completely before the VTK
6.0 release.

 - David



More information about the vtk-developers mailing list