{"thread":{"id":"21661","subject":"[PATCH RESEND] Explicitly truncate bswap operand to uint32_t","startedAt":"2009-11-18T13:53:27Z","lastAt":"2009-11-23T00:16:58Z","messageCount":2,"participants":["Benjamin Kramer","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"127847","messageId":"4B03FC57.5000506@googlemail.com","threadId":"21661","inReplyTo":null,"subject":"[PATCH RESEND] Explicitly truncate bswap operand to uint32_t","fromName":"Benjamin Kramer","fromEmail":"benny.kra@googlemail.com","sentAt":"2009-11-18T13:53:27Z","receivedAt":"2009-11-18T13:53:27Z","isPatch":true,"sender":{"key":"benny.kra@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/16542?v=4"},"body":"There are some places in git where a long is passed to htonl/ntohl. llvm\ndoesn't support matching operands of different bitwidths intentionally.\nThis patch fixes the build with llvm-gcc (and clang) on x86_64.\n\nSigned-off-by: Benjamin Kramer <benny.kra@googlemail.com>\n---\nAny comments on this patch?\n\nSee also:\n* http://llvm.org/bugs/show_bug.cgi?id=3373\n* http://lkml.org/lkml/2009/1/23/261\n\n compat/bswap.h |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/compat/bswap.h b/compat/bswap.h\nindex 279e0b4..f3b8c44 100644\n--- a/compat/bswap.h\n+++ b/compat/bswap.h\n@@ -24,7 +24,7 @@ static inline uint32_t default_swab32(uint32_t val)\n \tif (__builtin_constant_p(x)) { \\\n \t\t__res = default_swab32(x); \\\n \t} else { \\\n-\t\t__asm__(\"bswap %0\" : \"=r\" (__res) : \"0\" (x)); \\\n+\t\t__asm__(\"bswap %0\" : \"=r\" (__res) : \"0\" ((uint32_t)(x))); \\\n \t} \\\n \t__res; })\n \n-- \n1.6.5.3.149.g9aa3\n"},{"id":"128140","messageId":"7vfx86aydh.fsf@alter.siamese.dyndns.org","threadId":"21661","inReplyTo":"4B03FC57.5000506@googlemail.com","subject":"Re: [PATCH RESEND] Explicitly truncate bswap operand to uint32_t","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-11-23T00:16:58Z","receivedAt":"2009-11-23T00:16:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Benjamin Kramer <benny.kra@googlemail.com> writes:\n\n> There are some places in git where a long is passed to htonl/ntohl. llvm\n> doesn't support matching operands of different bitwidths intentionally.\n> This patch fixes the build with llvm-gcc (and clang) on x86_64.\n>\n> Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com>\n> ---\n> Any comments on this patch?\n\nMy vague recollection is that the response was \"we do not mind it per-se,\nunless it ends up in an ugly change; but we would prefer if you go fix\nyour compiler\", but maybe I read it on lkml not here?\n\nAlso my vague recollection is that the kernel folks took that patch in the\nend, so I think it is Ok for us to take this patch, too.\n"}]}