lib: bitmap: remove unnecessary mask from bitmap_complement
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Wed, 6 Aug 2014 23:09:57 +0000 (16:09 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 7 Aug 2014 01:01:26 +0000 (18:01 -0700)
Since the extra bits are "don't care", there is no reason to mask the
last word to the used bits when complementing.  This shaves off yet a
few bytes.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/bitmap.h
lib/bitmap.c

index 21fb52ffe444666bc7d3c054a55bf56bdab1803b..f42d72d5fe826b7c145c53fec3e2ed468d478d33 100644 (file)
@@ -225,7 +225,7 @@ static inline void bitmap_complement(unsigned long *dst, const unsigned long *sr
                        unsigned int nbits)
 {
        if (small_const_nbits(nbits))
-               *dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits);
+               *dst = ~(*src);
        else
                __bitmap_complement(dst, src, nbits);
 }
index 0f2f845702eb0f397f9894d94bf125b8e4f75441..4387e3c092fdfa92911071934525ef7257e4efb9 100644 (file)
@@ -93,7 +93,7 @@ void __bitmap_complement(unsigned long *dst, const unsigned long *src, unsigned
                dst[k] = ~src[k];
 
        if (bits % BITS_PER_LONG)
-               dst[k] = ~src[k] & BITMAP_LAST_WORD_MASK(bits);
+               dst[k] = ~src[k];
 }
 EXPORT_SYMBOL(__bitmap_complement);