From: "Randy.Dunlap" <rddunlap@osdl.org>
To: lkml <linux-kernel@vger.kernel.org>
Cc: akpm <akpm@osdl.org>
Subject: [PATCH] hweight: typecast return types
Date: Wed, 2 Mar 2005 21:58:28 -0800 [thread overview]
Message-ID: <20050302215828.0c5be29b.rddunlap@osdl.org> (raw)
Make hweight() macros return unsigned int for 8,16,32 bits,
instead of requiring callers to do that.
drivers/input/joystick/analog.c:414: warning: int format, different type arg (arg 3)
drivers/input/joystick/analog.c:414: warning: int format, different type arg (arg 4)
drivers/input/joystick/analog.c:418: warning: int format, different type arg (arg 4)
Note: does not address parisc, s390, or sparc64...
waiting for comments.
Signed-off-by: Randy Dunlap <rddunlap@osdl.org>
diffstat:=
include/asm-alpha/bitops.h | 6 +++---
include/asm-ia64/bitops.h | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff -Naurp ./include/asm-alpha/bitops.h~hweight_types ./include/asm-alpha/bitops.h
--- ./include/asm-alpha/bitops.h~hweight_types 2005-03-01 23:38:09.000000000 -0800
+++ ./include/asm-alpha/bitops.h 2005-03-02 12:56:01.746250696 -0800
@@ -353,9 +353,9 @@ static inline unsigned long hweight64(un
return __kernel_ctpop(w);
}
-#define hweight32(x) hweight64((x) & 0xfffffffful)
-#define hweight16(x) hweight64((x) & 0xfffful)
-#define hweight8(x) hweight64((x) & 0xfful)
+#define hweight32(x) (unsigned int) hweight64((x) & 0xfffffffful)
+#define hweight16(x) (unsigned int) hweight64((x) & 0xfffful)
+#define hweight8(x) (unsigned int) hweight64((x) & 0xfful)
#else
static inline unsigned long hweight64(unsigned long w)
{
diff -Naurp ./include/asm-ia64/bitops.h~hweight_types ./include/asm-ia64/bitops.h
--- ./include/asm-ia64/bitops.h~hweight_types 2005-03-01 23:38:38.000000000 -0800
+++ ./include/asm-ia64/bitops.h 2005-03-02 12:59:27.282004512 -0800
@@ -353,9 +353,9 @@ hweight64 (unsigned long x)
return result;
}
-#define hweight32(x) hweight64 ((x) & 0xfffffffful)
-#define hweight16(x) hweight64 ((x) & 0xfffful)
-#define hweight8(x) hweight64 ((x) & 0xfful)
+#define hweight32(x) (unsigned int) hweight64((x) & 0xfffffffful)
+#define hweight16(x) (unsigned int) hweight64((x) & 0xfffful)
+#define hweight8(x) (unsigned int) hweight64((x) & 0xfful)
#endif /* __KERNEL__ */
---
reply other threads:[~2005-03-03 6:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050302215828.0c5be29b.rddunlap@osdl.org \
--to=rddunlap@osdl.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®