diff options
Diffstat (limited to 'lib/bitmap.c')
-rw-r--r-- | lib/bitmap.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c index 74bdf3601245..36e380da00c5 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c | |||
@@ -169,15 +169,14 @@ void __bitmap_shift_left(unsigned long *dst, const unsigned long *src, | |||
169 | * word below and make them the bottom rem bits of result. | 169 | * word below and make them the bottom rem bits of result. |
170 | */ | 170 | */ |
171 | if (rem && k > 0) | 171 | if (rem && k > 0) |
172 | lower = src[k - 1]; | 172 | lower = src[k - 1] >> (BITS_PER_LONG - rem); |
173 | else | 173 | else |
174 | lower = 0; | 174 | lower = 0; |
175 | upper = src[k]; | 175 | upper = src[k]; |
176 | if (left && k == lim - 1) | 176 | if (left && k == lim - 1) |
177 | upper &= (1UL << left) - 1; | 177 | upper &= (1UL << left) - 1; |
178 | dst[k + off] = upper << rem; | 178 | upper <<= rem; |
179 | if (rem) | 179 | dst[k + off] = lower | upper; |
180 | dst[k + off] |= lower >> (BITS_PER_LONG - rem); | ||
181 | if (left && k + off == lim - 1) | 180 | if (left && k + off == lim - 1) |
182 | dst[k + off] &= (1UL << left) - 1; | 181 | dst[k + off] &= (1UL << left) - 1; |
183 | } | 182 | } |