* [GIT PULL] core/types change for v3.15
@ 2014-03-31 9:13 Ingo Molnar
0 siblings, 0 replies; only message in thread
From: Ingo Molnar @ 2014-03-31 9:13 UTC (permalink / raw)
To: Linus Torvalds
Cc: linux-kernel, Peter Zijlstra, Thomas Gleixner, Andrew Morton
Linus,
Please pull the latest core-types-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core-types-for-linus
# HEAD: c32fa99f0b4252633aa464e28d1cb925bd2a79df bitops: Fix signedness of compile-time hweight implementations
This lone commit makes sure that __const_hweight8() is unsigned, which
addresses a build warning if code is built with -Wsign-compare.
I hope the type cast in this cleanup is fine - another option would be
to eliminate the double unary negation and use a construct with more
obvious integer type characteristics, along the lines of:
((w) & (1ULL << 1) ? 1U : 0U)
or so.
Thanks,
Ingo
------------------>
Paul Walmsley (1):
bitops: Fix signedness of compile-time hweight implementations
include/asm-generic/bitops/const_hweight.h | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/include/asm-generic/bitops/const_hweight.h b/include/asm-generic/bitops/const_hweight.h
index fa2a50b..0a7e066 100644
--- a/include/asm-generic/bitops/const_hweight.h
+++ b/include/asm-generic/bitops/const_hweight.h
@@ -5,14 +5,15 @@
* Compile time versions of __arch_hweightN()
*/
#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))) )
+ ((unsigned int) \
+ ((!!((w) & (1ULL << 0))) + \
+ (!!((w) & (1ULL << 1))) + \
+ (!!((w) & (1ULL << 2))) + \
+ (!!((w) & (1ULL << 3))) + \
+ (!!((w) & (1ULL << 4))) + \
+ (!!((w) & (1ULL << 5))) + \
+ (!!((w) & (1ULL << 6))) + \
+ (!!((w) & (1ULL << 7)))))
#define __const_hweight16(w) (__const_hweight8(w) + __const_hweight8((w) >> 8 ))
#define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-03-31 9:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-31 9:13 [GIT PULL] core/types change for v3.15 Ingo Molnar
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.