I have got an array of chars that I\'m trying to bitwise shift right >>, then & with another array. I think I have got the wrong idea of
/**
* shift a number of bits to the right
*
* @param SRC the array to shift
* @param len the length of the array
* @param shift the number of consecutive bits to shift
*
*/
static void shift_bits_right(uint8_t SRC[], uint16_t len, uint32_t shift) {
uint32_t i = 0;
uint8_t start = shift / 8;
uint8_t rest = shift % 8;
uint8_t previous = 0;
for(i = 0; i < len; i++) {
if(start <= i) {
previous = SRC[i - start];
}
uint8_t value = (previous << (8 - rest)) | SRC[i + start] >> rest;
SRC[i + start] = value;
}
}