From 44d2b62a70f8ff672a30d127e060ce8072fbc787 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= <gaetan.harter@fu-berlin.de>
Date: Tue, 12 Feb 2019 18:33:24 +0100
Subject: [PATCH] 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.
---
 tests/rng/test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/rng/test.c b/tests/rng/test.c
index d73722e4e8..02555a3344 100644
--- a/tests/rng/test.c
+++ b/tests/rng/test.c
@@ -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]++;
             }
         }
-- 
GitLab