Draft
Conversation
Include bool, integral, and floating-point support Refactored `itk::Math::abs` with constexpr for bool, integer and floating point types. Conditionally use `std::abs` within itk:: when constexpr is available (i.e. c++23 and greater), or revert to custom constexpr code for c++17-c++23. Maintain backward compatibility with pre-ITKv6.0 computations while enabling explicit `std::abs` usage for modern standards. Signed types are promoted to unsigned return types for integers. Remove "using std::abs" which was polluting the itk namespace with hard to interpret intent, provide explicit support for all itk types with the itk::safe_abs(). itk::safe_abs is constexpr compatible for bool, floating, and integer types.
- Removed redundant definitions of `IsPrime` and `GreatestPrimeFactor` in `itkMath.cxx` by incorporating template-based implementations in `itkMath.h`. - Improved compile-time evaluation and type safety with `constexpr` and `std::enable_if_t`. - Updated tests to leverage the new `constexpr` `itk::Math` functions. - Enhanced maintainability by consolidating code and leveraging modern C++ features.
d2b3b7e to
7583f8e
Compare
Use GTest framework for testing the math functions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
itk::Math::absitk::Mathprime-related functions withconstexprPR Checklist