Commit 44b099e0 authored by Randy Dunlap's avatar Randy Dunlap Committed by Linus Torvalds

[PATCH] hweight: typecast return types

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: default avatarRandy Dunlap <rddunlap@osdl.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6179c472
......@@ -353,9 +353,9 @@ static inline unsigned long hweight64(unsigned long w)
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)
{
......
......@@ -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__ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment