Browse Source

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>
maint
Benjamin Kramer 15 years ago committed by Junio C Hamano
parent
commit
b073b7a990
  1. 2
      compat/bswap.h

2
compat/bswap.h

@ -24,7 +24,7 @@ static inline uint32_t default_swab32(uint32_t val)
if (__builtin_constant_p(x)) { \ if (__builtin_constant_p(x)) { \
__res = default_swab32(x); \ __res = default_swab32(x); \
} else { \ } else { \
__asm__("bswap %0" : "=r" (__res) : "0" (x)); \ __asm__("bswap %0" : "=r" (__res) : "0" ((uint32_t)(x))); \
} \ } \
__res; }) __res; })



Loading…
Cancel
Save