* WARNING:'hweight_long' include/linux/bitops.h compile warning problem.
@ 2011-06-20 8:08 NamJae Jeon
0 siblings, 0 replies; only message in thread
From: NamJae Jeon @ 2011-06-20 8:08 UTC (permalink / raw)
To: linux-kernel, arnd, linux-arch
Hello. Arnd
I found compile warning while compiling module when using -Wsign-compare option.
include/linux/bitops.h: In function 'hweight_long':
include/linux/bitops.h:49: warning: signed and unsigned type in
conditional expression
I found the reason of this problem that the default return value of
the below macro is signed.
#define __const_hweight8(w) \
( (!!((w) & (1ULL << 0))) + \
(!!((w) & (1ULL << 1))) + \
(!!((w) & (1ULL << 2))) + \
(!!((w) & (1ULL << 3))) + \
(!!((w) & (1ULL << 4))) + \
(!!((w) & (1ULL << 5))) + \
(!!((w) & (1ULL << 6))) + \
(!!((w) & (1ULL << 7))) )
So, I try to add (unsigned long) in __const_hweight8 like this.
#define __const_hweight8(w) (unsigned long ) \
( (!!((w) & (1ULL << 0))) + \
(!!((w) & (1ULL << 1))) + \
(!!((w) & (1ULL << 2))) + \
(!!((w) & (1ULL << 3))) + \
(!!((w) & (1ULL << 4))) + \
(!!((w) & (1ULL << 5))) + \
(!!((w) & (1ULL << 6))) + \
(!!((w) & (1ULL << 7))) )
so, I can't see compile warning after fixing it, Would you plz check this ?
Thanks.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-06-20 8:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-20 8:08 WARNING:'hweight_long' include/linux/bitops.h compile warning problem NamJae Jeon
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).