diff options
| author | Akinobu Mita <[email protected]> | 2006-03-26 09:39:56 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2006-03-26 16:57:15 +0000 |
| commit | 37d54111c133bea05fbae9dfe6d3d61a1b19c09b (patch) | |
| tree | 780d15232a465815b96e2cd22c85b3e05f2b1238 /lib/bitmap.c | |
| parent | [PATCH] bitops: remove unused generic bitops in include/linux/bitops.h (diff) | |
| download | kernel-37d54111c133bea05fbae9dfe6d3d61a1b19c09b.tar.gz kernel-37d54111c133bea05fbae9dfe6d3d61a1b19c09b.zip | |
[PATCH] bitops: hweight() related cleanup
By defining generic hweight*() routines
- hweight64() will be defined on all architectures
- hweight_long() will use architecture optimized hweight32() or hweight64()
I found two possible cleanups by these reasons.
Signed-off-by: Akinobu Mita <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/bitmap.c')
| -rw-r--r-- | lib/bitmap.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c index 8acab0e176ef..ed2ae3b0cd06 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -253,33 +253,18 @@ int __bitmap_subset(const unsigned long *bitmap1, } EXPORT_SYMBOL(__bitmap_subset); -#if BITS_PER_LONG == 32 int __bitmap_weight(const unsigned long *bitmap, int bits) { int k, w = 0, lim = bits/BITS_PER_LONG; for (k = 0; k < lim; k++) - w += hweight32(bitmap[k]); + w += hweight_long(bitmap[k]); if (bits % BITS_PER_LONG) - w += hweight32(bitmap[k] & BITMAP_LAST_WORD_MASK(bits)); + w += hweight_long(bitmap[k] & BITMAP_LAST_WORD_MASK(bits)); return w; } -#else -int __bitmap_weight(const unsigned long *bitmap, int bits) -{ - int k, w = 0, lim = bits/BITS_PER_LONG; - - for (k = 0; k < lim; k++) - w += hweight64(bitmap[k]); - - if (bits % BITS_PER_LONG) - w += hweight64(bitmap[k] & BITMAP_LAST_WORD_MASK(bits)); - - return w; -} -#endif EXPORT_SYMBOL(__bitmap_weight); /* |
