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

formatString_u() can display numbers > 100 #4113

Merged
merged 2 commits into from
Aug 9, 2024
Merged

formatString_u() can display numbers > 100 #4113

merged 2 commits into from
Aug 9, 2024

Conversation

Cyan4973
Copy link
Contributor

@Cyan4973 Cyan4973 commented Aug 6, 2024

benchmark can now run on > 100 files without option -S.
fixes #4110

Comment on lines +142 to +150
static size_t uintSize(unsigned value)
{
size_t size = 1;
while (value >= 10) {
size++;
value /= 10;
}
return size;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This solution has an admirable simplicity, but there are reasonably compact, if non-obvious, fast solutions available:

https://lemire.me/blog/2021/06/03/computing-the-number-of-digits-of-an-integer-even-faster/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice reference !
This could be useful in a hot conversion to ascii loop

@Cyan4973 Cyan4973 merged commit 10e2a80 into dev Aug 9, 2024
93 checks passed
@Cyan4973 Cyan4973 deleted the fix4110 branch September 3, 2024 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash on benchmark using recursive flag
3 participants