From: Jeff King Date: Tue, 29 Dec 2015 06:35:46 +0000 (-0500) Subject: avoid shifting signed integers 31 bits X-Git-Tag: v2.7.1~25^2~1 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/9a93c6686f56086fe5280a85513041bbfebf41d0?hp=9a93c6686f56086fe5280a85513041bbfebf41d0 avoid shifting signed integers 31 bits We sometimes use 32-bit unsigned integers as bit-fields. It's fine to access the MSB, because it's unsigned. However, doing so as "1 << 31" is wrong, because the constant "1" is a signed int, and we shift into the sign bit, causing undefined behavior. We can fix this by using "1U" as the constant. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano ---