@matheusbsbs / matheus-bagliano / commits / b073b7a990
Fork 0

Explicitly truncate bswap operand to uint32_t

There are some places in git where a long is passed to htonl/ntohl. llvm doesn't support matching operands of different bitwidths intentionally. This patch fixes the build with llvm-gcc (and clang) on x86_64. Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Benjamin Kramer committed Nov 18, 2009 at 14:53 UTC b073b7a990deb1cb3425db45642fa18c8b3cb65c
1 file changed +1 -1
compat/bswap.h
+1 -1
@@ -24,7 +24,7 @@ static inline uint32_t default_swab32(uint32_t val)
24 if (__builtin_constant_p(x)) { \
25 __res = default_swab32(x); \
26 } else { \
27 - __asm__("bswap %0" : "=r" (__res) : "0" (x)); \
27 + __asm__("bswap %0" : "=r" (__res) : "0" ((uint32_t)(x))); \
28 } \
29 __res; })
30