[Mesa-dev] [PATCH 3/3] util: fix MSVC warning in u_align_u32()

Brian Paul brianp at vmware.com
Mon Apr 3 16:09:51 UTC 2017


To silence
C:\Users\Brian\projects\mesa\src\util/u_vector.h(41) : warning C4146: unary
minus operator applied to unsigned type, result still unsigned
---
 src/util/u_vector.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/u_vector.h b/src/util/u_vector.h
index f97a8b4..c7fcb37 100644
--- a/src/util/u_vector.h
+++ b/src/util/u_vector.h
@@ -38,7 +38,7 @@
 static inline uint32_t
 u_align_u32(uint32_t v, uint32_t a)
 {
-   assert(a != 0 && a == (a & -a));
+   assert(a != 0 && a == (a & -((int32_t) a)));
    return (v + a - 1) & ~(a - 1);
 }
 
-- 
1.9.1



More information about the mesa-dev mailing list