{"thread":{"id":"21423","subject":"[PATCH] Explicitly truncate bswap operand to uint32_t","startedAt":"2009-10-29T17:43:54Z","lastAt":"2009-10-29T17:43:54Z","messageCount":1,"participants":["Benjamin Kramer"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"126298","messageId":"4AE9D45A.9010805@googlemail.com","threadId":"21423","inReplyTo":null,"subject":"[PATCH] Explicitly truncate bswap operand to uint32_t","fromName":"Benjamin Kramer","fromEmail":"benny.kra@googlemail.com","sentAt":"2009-10-29T17:43:54Z","receivedAt":"2009-10-29T17:43:54Z","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---\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 5cc4acb..52fc7b6 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.2.102.g442a9\n"}]}