panfrost: Mark (1 << 31) as unsigned
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Sat, 31 Aug 2019 00:34:13 +0000 (17:34 -0700)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Tue, 3 Sep 2019 11:55:29 +0000 (13:55 +0200)
I was not aware this incurred undefined behaviour; thank you cppcheck.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
src/gallium/drivers/panfrost/pan_instancing.c

index e5a1e7cfae30e1e14a5c0241554b0d9fd1c968c2..fc63cdbb25d77570d40aed626553e208b4419f74 100644 (file)
@@ -221,7 +221,7 @@ panfrost_vertex_instanced(
                 unsigned m = m_f;
 
                 /* Default case */
-                unsigned magic_divisor = m, extra_flags = 0;
+                uint32_t magic_divisor = m, extra_flags = 0;
 
                 /* e = 2^(shift + 32) % d */
                 uint64_t e = t % hw_divisor;
@@ -234,8 +234,8 @@ panfrost_vertex_instanced(
                 }
 
                 /* Top flag implicitly set */
-                assert(magic_divisor & (1 << 31));
-                magic_divisor &= ~(1 << 31);
+                assert(magic_divisor & (1u << 31));
+                magic_divisor &= ~(1u << 31);
 
                 /* Upload to two different slots */