diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-02-01 15:03:07 +0100 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-04-06 15:52:11 -0700 |
commit | 1527bc8b928dd1399c3d3467dd47d9ede210978a (patch) | |
tree | fb391da915bdae9f933b8170ff61aa43c85ef9ae /include/asm-generic/bitops/arch_hweight.h | |
parent | 0fdf86754f70e813845af4abaa805165ce57a0bb (diff) | |
download | linux-1527bc8b928dd1399c3d3467dd47d9ede210978a.tar.gz linux-1527bc8b928dd1399c3d3467dd47d9ede210978a.tar.bz2 linux-1527bc8b928dd1399c3d3467dd47d9ede210978a.zip |
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/arch_hweight.h')
-rw-r--r-- | include/asm-generic/bitops/arch_hweight.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/asm-generic/bitops/arch_hweight.h b/include/asm-generic/bitops/arch_hweight.h new file mode 100644 index 000000000000..3a7be842cdce --- /dev/null +++ b/include/asm-generic/bitops/arch_hweight.h @@ -0,0 +1,11 @@ +#ifndef _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_ +#define _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_ + +#include <asm/types.h> + +extern unsigned int __arch_hweight32(unsigned int w); +extern unsigned int __arch_hweight16(unsigned int w); +extern unsigned int __arch_hweight8(unsigned int w); +extern unsigned long __arch_hweight64(__u64 w); + +#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */ |