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

fix: Fix power of two computation on 32bit architectures #1624

Merged
merged 1 commit into from
Oct 18, 2022

Conversation

theduke
Copy link
Contributor

@theduke theduke commented Oct 16, 2022

The current compute_previous_power_of_two() implementation used for TermHashmap takes and returns usize , but actually only works correclty on 64 bit architectures (aka usize == u64)

On other architectures the leading_zeros computation is run on the wrong type (must be u64), and leads to overflows.

Fixed simply computing the leading_zeros based on a u64 value.

The current `compute_previous_power_of_two()` implementation used for
TermHashmap takes and returns `usize` , but actually only works
correclty on 64 bit architectures (aka usize == u64)

On other architectures the leading_zeros computation is run on the wrong
type (must be u64), and leads to overflows.

Fixed simply computing the leading_zeros based on a u64 value.
@fulmicoton fulmicoton merged commit 96c3d54 into quickwit-oss:main Oct 18, 2022
This was referenced Jan 13, 2023
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