* [PATCH RESEND] Explicitly truncate bswap operand to uint32_t
@ 2009-11-18 13:53 Benjamin Kramer
2009-11-23 0:16 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Kramer @ 2009-11-18 13:53 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Nicolas Pitre
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>
---
Any comments on this patch?
See also:
* http://llvm.org/bugs/show_bug.cgi?id=3373
* http://lkml.org/lkml/2009/1/23/261
compat/bswap.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/compat/bswap.h b/compat/bswap.h
index 279e0b4..f3b8c44 100644
--- a/compat/bswap.h
+++ b/compat/bswap.h
@@ -24,7 +24,7 @@ static inline uint32_t default_swab32(uint32_t val)
if (__builtin_constant_p(x)) { \
__res = default_swab32(x); \
} else { \
- __asm__("bswap %0" : "=r" (__res) : "0" (x)); \
+ __asm__("bswap %0" : "=r" (__res) : "0" ((uint32_t)(x))); \
} \
__res; })
--
1.6.5.3.149.g9aa3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RESEND] Explicitly truncate bswap operand to uint32_t
2009-11-18 13:53 [PATCH RESEND] Explicitly truncate bswap operand to uint32_t Benjamin Kramer
@ 2009-11-23 0:16 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2009-11-23 0:16 UTC (permalink / raw)
To: Benjamin Kramer; +Cc: git, Nicolas Pitre
Benjamin Kramer <benny.kra@googlemail.com> writes:
> 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>
> ---
> Any comments on this patch?
My vague recollection is that the response was "we do not mind it per-se,
unless it ends up in an ugly change; but we would prefer if you go fix
your compiler", but maybe I read it on lkml not here?
Also my vague recollection is that the kernel folks took that patch in the
end, so I think it is Ok for us to take this patch, too.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-23 0:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-18 13:53 [PATCH RESEND] Explicitly truncate bswap operand to uint32_t Benjamin Kramer
2009-11-23 0:16 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).