aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRasmus Villemoes <linux@rasmusvillemoes.dk>2015-02-13 14:36:08 -0800
committerMister Oyster <oysterized@gmail.com>2017-04-11 10:59:36 +0200
commit182df8d94f7b75d0274a774c704c077bc1fbbdf3 (patch)
tree585699d2e85824ac72efa6e075233a5fce9fe47c /lib
parent4e8ee1ec9f82e439d45e655b47b49b2866cc1cc4 (diff)
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/bitmap.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 204f09607..e3e91a343 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -134,8 +134,6 @@ void __bitmap_shift_right(unsigned long *dst, const unsigned long *src,
lower &= mask;
lower >>= rem;
dst[k] = lower | upper;
- if (left && k == lim - 1)
- dst[k] &= mask;
}
if (off)
memset(&dst[lim - off], 0, off*sizeof(unsigned long));