Update crc32c_round_up.h - gcc -Werror=sign-conversion supression
#71
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Greetings! I spotted the next warning (using
gcc (GCC) 15.1.1 20250425) (in my case with-Werror& other flags for strictness - its an error):This warning is caused by implicit signed-to-unsigned conversion when
~(N - 1)is evaluated. The result of the~operator on anintmay be negative (e.g.,~3 = -4), and converting that touintptr_tresults in a large positive number due to two's complement representation.That's why I added explicit cast of
(N - 1)intouintptr_tbefore applying thebitwise-not.Why this fix works and dont break everything:
Nis of typeint, soN - 1is also anint.~(N - 1)thus results in anint, which might be negative.&with pointer (which isuintptr_t), theintgets implicitly converted touintptr_t. If it’s negative, the result is a large positive value (e.g.,-4becomes0xFFFFFFFFFFFFFFFCon a 64-bit system).(N - 1)touintptr_tbefore applying~ensures the operation is done in unsigned arithmetic, resulting in the correct bitmask without sign-conversion issues.With this small fix everything was build successfully without any other warnings/errors (on x86_64).