diff options
author | Andrew Morton <akpm@osdl.org> | 2004-02-07 17:42:08 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@home.osdl.org> | 2004-02-07 17:42:08 -0800 |
commit | 1f6a152802ef90851b5f97e509e12d1e84819ddc (patch) | |
tree | a61061cf6baf182109f0a51665d7407ade97e5d3 /lib | |
parent | 79cd789d8d81fbfa5362637a5d993cb903a2b487 (diff) | |
download | history-1f6a152802ef90851b5f97e509e12d1e84819ddc.tar.gz |
[PATCH] bitmap_snprintf() optimization
From: Joe Korty <joe.korty@ccur.com>
Now that bitmap_parse is part of bitmap.[ch], it is allowed to manipulate
bits directly as the other bitmap routines do.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bitmap.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c index fb09dffaa557ba..5e93a93c0136e1 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -220,7 +220,7 @@ EXPORT_SYMBOL(bitmap_snprintf); int bitmap_parse(const char __user *ubuf, unsigned int ubuflen, unsigned long *maskp, int nmaskbits) { - int i, c, old_c, totaldigits, ndigits, nchunks, nbits; + int c, old_c, totaldigits, ndigits, nchunks, nbits; u32 chunk; bitmap_clear(maskp, nmaskbits); @@ -270,9 +270,7 @@ int bitmap_parse(const char __user *ubuf, unsigned int ubuflen, continue; bitmap_shift_right(maskp, maskp, CHUNKSZ, nmaskbits); - for (i = 0; i < CHUNKSZ; i++) - if (chunk & (1 << i)) - set_bit(i, maskp); + *maskp |= chunk; nchunks++; nbits += (nchunks == 1) ? nbits_to_hold_value(chunk) : CHUNKSZ; if (nbits > nmaskbits) |