Skip to content

Commit b073b7a

Browse files
d0kgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5d166cc commit b073b7a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compat/bswap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static inline uint32_t default_swab32(uint32_t val)
2424
if (__builtin_constant_p(x)) { \
2525
__res = default_swab32(x); \
2626
} else { \
27-
__asm__("bswap %0" : "=r" (__res) : "0" (x)); \
27+
__asm__("bswap %0" : "=r" (__res) : "0" ((uint32_t)(x))); \
2828
} \
2929
__res; })
3030

0 commit comments

Comments
 (0)