[vtk-developers] Possible changes to vtkMath...

Andy Cedilnik andy.cedilnik at kitware.com
Fri Jul 11 09:04:29 EDT 2003


Hi All,

How about template? That should be faster. 

Something like

template <class DataType>
DataType VTK_ABS(DataType d)
{
  return ((d < 0.0 ) ? (-d) : (d) );
}

			Andy

On Thu, 2003-07-10 at 19:47, Michael Halle wrote:
> I don't like the idea of a fabs()-based macro because
> of the double-evaluation side effects.  Conditionally
> defining it only makes it worse. The ternary operator
> may or may not be highly optimized on some platforms.
> 
> Inlining is the defined mechanism for this purpose, even
> if it may be slower on some platforms, I think it's the
> best choice.
> Michael Halle
> mhalle at bwh.harvard.edu





More information about the vtk-developers mailing list