Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace various std::pow(2.0, x) calls with 1ULL << x #5257

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

N-Dekker
Copy link
Contributor

@github-actions github-actions bot added area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module labels Feb 25, 2025
// using BoundingBoxVerticesType = itk::FixedArray<
// LabelPointType,std::pow(2.0,Self::ImageDimension)>;
// using BoundingBoxVerticesType = itk::FixedArray<LabelPointType, 1ULL << Self::ImageDimension>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the original idea was to make BoundingBoxVerticesType an itk::FixedArray, instead of a std::vector, but then that seemed impossible because std::pow wasn't constexpr. Just guessing. 🤷

Follow-up to pull request InsightSoftwareConsortium#5252
commit 2bd9f0a
"STYLE: Replace `std::pow(2, dim)` calls with `1 << dim`"

Included replacing `std::pow(2, dim)` calls in comments.
Using left-shift instead of `std::pow(2, x)` allows the local variable
`BSplineTransformDomainEpsilon` to be declared `constexpr`.
@N-Dekker N-Dekker marked this pull request as ready for review February 25, 2025 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants