diff options
author | Paul Walmsley <[email protected]> | 2013-12-18 05:02:14 -0800 |
---|---|---|
committer | Ingo Molnar <[email protected]> | 2014-02-09 13:39:26 +0100 |
commit | c32fa99f0b4252633aa464e28d1cb925bd2a79df (patch) | |
tree | 3f857effbb10d28785fa4d4cc8d0f2fbe1c1e7ba /tools | |
parent | 494479038d97f1b9f76fc633a360a681acdf035c (diff) |
bitops: Fix signedness of compile-time hweight implementations
Enabling '-Wsign-compare' compiler warnings on code that includes
include/linux/bitops.h can generate the following warning:
In file included from include/linux/kernel.h:10:0,
from <random filename>:48:
include/linux/bitops.h: In function 'hweight_long':
include/linux/bitops.h:77:26: error: signed and unsigned type in conditional expression [-Werror=sign-compare]
(converted to an error with -Werror)
This is due to the use of the logical negation operator '!' in the
__const_hweight8 macro in include/asm-generic/bitops/const_hweight.h.
The use of that operator here results in a signed value.
Fix by explicitly casting the __const_hweight8 macro expansion to
'unsigned int'. While here, clean up several checkpatch.pl warnings.
Signed-off-by: Paul Walmsley <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/alpine.DEB.2.02.1312180459580.30198@tamien
Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions