unsigned int shift, unsigned int nbits)
{
int k;
- unsigned int lim = BITS_TO_LONGS(nbits), left = nbits % BITS_PER_LONG;
+ unsigned int lim = BITS_TO_LONGS(nbits);
unsigned int off = shift/BITS_PER_LONG, rem = shift % BITS_PER_LONG;
for (k = lim - off - 1; k >= 0; --k) {
unsigned long upper, lower;
lower = src[k - 1] >> (BITS_PER_LONG - rem);
else
lower = 0;
- upper = src[k];
- if (left && k == lim - 1)
- upper &= (1UL << left) - 1;
- upper <<= rem;
+ upper = src[k] << rem;
dst[k + off] = lower | upper;
- if (left && k + off == lim - 1)
- dst[k + off] &= (1UL << left) - 1;
}
if (off)
memset(dst, 0, off*sizeof(unsigned long));