diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2015-02-13 23:36:08 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-14 06:21:35 +0100 |
commit | 97fb8e940bc56b157517c812c9c6cbfc83d48d78 (patch) | |
tree | 08fcd4c971c7047ef80d724a5c060c2e9b1c4f7f /lib/bitmap.c | |
parent | lib: bitmap: eliminate branch in __bitmap_shift_right (diff) | |
download | linux-97fb8e940bc56b157517c812c9c6cbfc83d48d78.tar.xz linux-97fb8e940bc56b157517c812c9c6cbfc83d48d78.zip |
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/bitmap.c')
-rw-r--r-- | lib/bitmap.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c index a7a8bc02892d..761d2d4989ee 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -136,8 +136,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)); |