diff options
Diffstat (limited to 'lib/bitmap.c')
-rw-r--r-- | lib/bitmap.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c index cd250a2e14cb..b499ab6ada29 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c | |||
@@ -131,7 +131,9 @@ void __bitmap_shift_right(unsigned long *dst, | |||
131 | lower = src[off + k]; | 131 | lower = src[off + k]; |
132 | if (left && off + k == lim - 1) | 132 | if (left && off + k == lim - 1) |
133 | lower &= mask; | 133 | lower &= mask; |
134 | dst[k] = upper << (BITS_PER_LONG - rem) | lower >> rem; | 134 | dst[k] = lower >> rem; |
135 | if (rem) | ||
136 | dst[k] |= upper << (BITS_PER_LONG - rem); | ||
135 | if (left && k == lim - 1) | 137 | if (left && k == lim - 1) |
136 | dst[k] &= mask; | 138 | dst[k] &= mask; |
137 | } | 139 | } |
@@ -172,7 +174,9 @@ void __bitmap_shift_left(unsigned long *dst, | |||
172 | upper = src[k]; | 174 | upper = src[k]; |
173 | if (left && k == lim - 1) | 175 | if (left && k == lim - 1) |
174 | upper &= (1UL << left) - 1; | 176 | upper &= (1UL << left) - 1; |
175 | dst[k + off] = lower >> (BITS_PER_LONG - rem) | upper << rem; | 177 | dst[k + off] = upper << rem; |
178 | if (rem) | ||
179 | dst[k + off] |= lower >> (BITS_PER_LONG - rem); | ||
176 | if (left && k + off == lim - 1) | 180 | if (left && k + off == lim - 1) |
177 | dst[k + off] &= (1UL << left) - 1; | 181 | dst[k + off] &= (1UL << left) - 1; |
178 | } | 182 | } |