Commit 97fb8e94 authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Linus Torvalds

lib: bitmap: remove redundant code from __bitmap_shift_right

If the condition k==lim-1 is true, we must have off == 0 (otherwise, k
could never become that big).  But in that case we have upper == 0 and
hence dst[k] == (src[k] & mask) >> rem.  Since mask consists of a
consecutive range of bits starting from the LSB, anding dst[k] with mask
is a no-op.
Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9d8a6b2a
...@@ -136,8 +136,6 @@ void __bitmap_shift_right(unsigned long *dst, const unsigned long *src, ...@@ -136,8 +136,6 @@ void __bitmap_shift_right(unsigned long *dst, const unsigned long *src,
lower &= mask; lower &= mask;
lower >>= rem; lower >>= rem;
dst[k] = lower | upper; dst[k] = lower | upper;
if (left && k == lim - 1)
dst[k] &= mask;
} }
if (off) if (off)
memset(&dst[lim - off], 0, off*sizeof(unsigned long)); memset(&dst[lim - off], 0, off*sizeof(unsigned long));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment