Skip to content

Commit 97fb8e9

Browse files
Villemoestorvalds
authored andcommitted
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: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 9d8a6b2 commit 97fb8e9

1 file changed

Lines changed: 0 additions & 2 deletions

File tree

‎lib/bitmap.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ void __bitmap_shift_right(unsigned long *dst, const unsigned long *src,
136136
lower &= mask;
137137
lower >>= rem;
138138
dst[k] = lower | upper;
139-
if (left && k == lim - 1)
140-
dst[k] &= mask;
141139
}
142140
if (off)
143141
memset(&dst[lim - off], 0, off*sizeof(unsigned long));

0 commit comments

Comments
 (0)