From 1f6a152802ef90851b5f97e509e12d1e84819ddc Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sat, 7 Feb 2004 17:42:08 -0800 Subject: [PATCH] [PATCH] bitmap_snprintf() optimization From: Joe Korty Now that bitmap_parse is part of bitmap.[ch], it is allowed to manipulate bits directly as the other bitmap routines do. --- lib/bitmap.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/bitmap.c b/lib/bitmap.c index fb09dffaa557b..5e93a93c0136e 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) -- 2.53.0