* [PATCH] hweight: typecast return types
@ 2005-03-03 5:58 Randy.Dunlap
0 siblings, 0 replies; only message in thread
From: Randy.Dunlap @ 2005-03-03 5:58 UTC (permalink / raw)
To: lkml; +Cc: akpm
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__ */
---
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-03-03 6:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-03 5:58 [PATCH] hweight: typecast return types Randy.Dunlap
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).