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

Use fixed width data type in crc32 calculation #22

Closed
wants to merge 1 commit into from
Closed

Use fixed width data type in crc32 calculation #22

wants to merge 1 commit into from

Conversation

stringflow
Copy link
Member

@stringflow stringflow commented Jan 31, 2024

Due to differences in compilers, the crc32 calculation in the no-libz-path may output different results.
The cause for this phenomenon, is that the data type unsigned long may be of different size depending on the compiler. An example of this occuring, and its consequences can be seen here: https://godbolt.org/z/x1bcGW9n6

This PR attempts to fix the issue by using a fixed 32-bit width data type instead.

@CasualPokePlayer
Copy link
Member

uint_least32_t isn't a fixed width type, so this isn't the correct necessarily (uint32_t is the actual fixed width type that uint_least32_t usually corresponds to).

I'm fairly sure however all you actually need to fix the issue is to have a & 0xFFFFFFFF to the ~ usages if anything.

@CasualPokePlayer
Copy link
Member

Should be fixed in 809ba4f

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.

2 participants