mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
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.
This commit is contained in:
parent
643de0a857
commit
44d2b62a70
@ -154,7 +154,7 @@ void test_distributions(uint32_t samples)
|
||||
|
||||
/* count bits */
|
||||
for (int i = 0; i < 32; i++) {
|
||||
if (value & (1 << i)) {
|
||||
if (value & (UINT32_C(1) << i)) {
|
||||
distributions[i]++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user