Skip to content
Snippets Groups Projects
Unverified Commit 44d2b62a authored by Gaëtan Harter's avatar Gaëtan Harter Committed by cladmi
Browse files

tests/rng: fix cppcheck error shiftTooManyBitsSigned

cpp check is reporting the following error

    error (shiftTooManyBitsSigned):
    Shifting signed 32-bit value by 31 bits is undefined behaviour

Fix by ensuring the `1` is an `uint32_t` before shifting.
parent 643de0a8
No related branches found
No related tags found
No related merge requests found
...@@ -154,7 +154,7 @@ void test_distributions(uint32_t samples) ...@@ -154,7 +154,7 @@ void test_distributions(uint32_t samples)
/* count bits */ /* count bits */
for (int i = 0; i < 32; i++) { for (int i = 0; i < 32; i++) {
if (value & (1 << i)) { if (value & (UINT32_C(1) << i)) {
distributions[i]++; distributions[i]++;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment