I do not have much expertise in bit operation as I am beginner. Can you help me or give me any clue! how to do this in C programming!- This function fetches bits from a byte array, which contains suitable number of bytes to cover the largest bit index in bit_idxs array. It assumes that the bytes in the array are composed as follows:
- if array = {0xA3, 0x58}, it assumes a number 0xA358 = 1010 0011 0101 1000, and assigns bit index 0 as the left most bit. if bit_idxs = {0, 2, 10} and n = 3, it fetch 1010 0011 0101 1000 ^ ^ ^ 1, 1, 0 since bit 0 is 1, bit 2 is 1, and bit 10 is 0. Then, it sums these bit values, which is 2. Before returning the sum,it clears the bits that are set, that is, it clears bit 0 and bit 2 so that the array becomes 0000 0011 0101 1000 ^ ^ ^ array = {0x03, 0x58}.