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

Low-risk C++11 and C++14 constexpr functions #177

Merged
merged 4 commits into from
Feb 28, 2023

Conversation

leni536
Copy link
Contributor

@leni536 leni536 commented Feb 25, 2023

I added constexpr to functions where the definitions need no or just minimal change.

I added the FASTFLOAT_CONSTEXPR14 to for functions that need at least C++14 to be marked constexpr.

@lemire
Copy link
Member

lemire commented Feb 25, 2023

This looks good. Let us run tests.

@lemire
Copy link
Member

lemire commented Feb 26, 2023

Running tests.

@@ -36,662 +36,663 @@ constexpr static int smallest_power_of_five = binary_format<double>::smallest_po
constexpr static int largest_power_of_five = binary_format<double>::largest_power_of_ten();
constexpr static int number_of_entries = 2 * (largest_power_of_five - smallest_power_of_five + 1);
// Powers of five from 5^-342 all the way to 5^308 rounded toward one.
static const uint64_t power_of_five_128[number_of_entries];
Copy link
Member

Choose a reason for hiding this comment

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

We need to make sure that the large table is included only once per project. I.e., if several compilation units include our header, we want the large table to appear only once in the final executable or library. That is why we use the strange template construction with an unused parameter.

Copy link
Member

Choose a reason for hiding this comment

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

I am not objecting to the PR. I am just raising a flag.

@lemire
Copy link
Member

lemire commented Feb 28, 2023

Ok. I am satisfied that it does not obviously create bloating.

@lemire lemire merged commit 52fed52 into fastfloat:main Feb 28, 2023
@lemire
Copy link
Member

lemire commented Feb 28, 2023

Merged.

@leni536 leni536 deleted the easy-constexpr branch March 3, 2023 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants