diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-02-01 09:03:07 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-04-06 18:52:11 -0400 |
commit | 1527bc8b928dd1399c3d3467dd47d9ede210978a (patch) | |
tree | fb391da915bdae9f933b8170ff61aa43c85ef9ae /include/asm-generic/bitops/hweight.h | |
parent | 0fdf86754f70e813845af4abaa805165ce57a0bb (diff) |
bitops: Optimize hweight() by making use of compile-time evaluation
Rename the extisting runtime hweight() implementations to
__arch_hweight(), rename the compile-time versions to __const_hweight()
and then have hweight() pick between them.
Suggested-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20100318111929.GB11152@aftab>
Acked-by: H. Peter Anvin <hpa@zytor.com>
LKML-Reference: <1265028224.24455.154.camel@laptop>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'include/asm-generic/bitops/hweight.h')
-rw-r--r-- | include/asm-generic/bitops/hweight.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/include/asm-generic/bitops/hweight.h b/include/asm-generic/bitops/hweight.h index fbbc383771da..a94d6519c7ed 100644 --- a/include/asm-generic/bitops/hweight.h +++ b/include/asm-generic/bitops/hweight.h | |||
@@ -1,11 +1,7 @@ | |||
1 | #ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_ | 1 | #ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_ |
2 | #define _ASM_GENERIC_BITOPS_HWEIGHT_H_ | 2 | #define _ASM_GENERIC_BITOPS_HWEIGHT_H_ |
3 | 3 | ||
4 | #include <asm/types.h> | 4 | #include <asm-generic/bitops/arch_hweight.h> |
5 | 5 | #include <asm-generic/bitops/const_hweight.h> | |
6 | extern unsigned int hweight32(unsigned int w); | ||
7 | extern unsigned int hweight16(unsigned int w); | ||
8 | extern unsigned int hweight8(unsigned int w); | ||
9 | extern unsigned long hweight64(__u64 w); | ||
10 | 6 | ||
11 | #endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */ | 7 | #endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */ |