Thread (3 messages) 3 messages, 2 authors, 2012-06-12

Re: [PATCH] include: Fix compile warning in include/linux/bitops.h

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2012-06-11 22:59:22
Also in: lkml

On Fri,  8 Jun 2012 23:15:30 -0400
Namjae Jeon [off-list ref] wrote:
The compile warning is caused by __const_hweight8 when using
hweight_long with -Wsign-compare option.
The reason is that the default return value of this macro is signed.
So need type casting to remove warning.
um, what warning?

Please always quote the compiler messages when fixing build warnings or
errors.
quoted hunk ↗ jump to hunk
index fa2a50b..3ad0dae 100644
--- a/include/asm-generic/bitops/const_hweight.h
+++ b/include/asm-generic/bitops/const_hweight.h
@@ -4,7 +4,7 @@
 /*
  * Compile time versions of __arch_hweightN()
  */
-#define __const_hweight8(w)		\
+#define __const_hweight8(w)	(unsigned long)	\
       (	(!!((w) & (1ULL << 0))) +	\
 	(!!((w) & (1ULL << 1))) +	\
 	(!!((w) & (1ULL << 2))) +	\
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help