Skip to content

Implement clamp with ternary for better optimization

David Gobbi requested to merge dgobbi/vtk:clamp-ternary into master

Both clang and MSVC are very good at optimizing this ternary into minsd, maxsd compiler instructions. For gcc, this optimizes best if -ffast-math is used (since gcc might otherwise be pedantic about the handling of inf, nan, and negative zero).

Edited by David Gobbi

Merge request reports