cache.h: hex2chr() - avoid -Wsign-compare warnings
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramsay Jones committed
Sep 21, 2017 at 17:48 UTC
356a293f39e101326b274e968552a7379735e230
1 file changed
+2
-2
cache.h
+2
-2
@@ -1264,8 +1264,8 @@ static inline unsigned int hexval(unsigned char c)
1264
*/
1265
static inline int hex2chr(const char *s)
1266
{
1267
- int val = hexval(s[0]);
1268
- return (val < 0) ? val : (val << 4) | hexval(s[1]);
1267
+ unsigned int val = hexval(s[0]);
1268
+ return (val & ~0xf) ? val : (val << 4) | hexval(s[1]);
1269
}
1270
1271
/* Convert to/from hex/sha1 representation */