I'm not sure what you're trying to do. If you want to extract all of the bits and move them to a new variable, just copy them. If you only want the low order bits, you'd do something like
You can shift mask up to pick something other than the least significant bits.
unsigned int mask = (1<<length) - 1; // fill mask with <length> bits of 1s
dest &= ~mask; // Clear out low order bits in dest
dest |= source & mask; // copy low order bits from source to dest, leaving the rest of dest intact.
If you're copying from a 32 bit value to an array of 4 8 bit values :
Combine the two bits of code if you only need to copy parts of source to dest.
dest = source;
dest = source >> 8;
dest = source >> 16;
dest = source >> 24;