diff options
author | Akinobu Mita <[email protected]> | 2009-12-21 16:20:16 -0800 |
---|---|---|
committer | Ingo Molnar <[email protected]> | 2009-12-28 10:41:39 +0100 |
commit | 39d997b514e12d5aff0dca206eb8996b3957927e (patch) | |
tree | d63202847a8a421fbd1fc39e9a2433dbc86ce104 /net/lapb/lapb_in.c | |
parent | 6b7b284958d47b77d06745b36bc7f36dab769d9b (diff) |
x86, core: Optimize hweight32()
Optimize hweight32 by using the same technique in hweight64.
The proof of this technique can be found in the commit log for
f9b4192923fa6e38331e88214b1fe5fc21583fcc ("bitops: hweight()
speedup").
The userspace benchmark on x86_32 showed 20% speedup with
bitmap_weight() which uses hweight32 to count bits for each
unsigned long on 32bit architectures.
int main(void)
{
#define SZ (1024 * 1024 * 512)
static DECLARE_BITMAP(bitmap, SZ) = {
[0 ... 100] = 1,
};
return bitmap_weight(bitmap, SZ);
}
Signed-off-by: Akinobu Mita <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Cc: Linus Torvalds <[email protected]>
LKML-Reference: <[email protected]>
[ only x86 sets ARCH_HAS_FAST_MULTIPLIER so we do this via the x86 tree]
Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'net/lapb/lapb_in.c')
0 files changed, 0 insertions, 0 deletions