so I am working with a data set that comes in as an array. For example:
{0x00, 0x00, 0xFF, 0xF1, 0x6D, 0xA2, 0x00 0x00}
{0b00000000, 0b00000000, 0b11111111, 0b11110001, 0b01101101, 0b10100010, 0b00000000, 0b00000000}
I need to be able to extract information from this array based on two values:
- The start bit.
- The number of bits.
For example, if the start bit was 17, and the bit length was 13, (assuming the first bit is index 0), my data would be:
0b1111111111100
Decimal: 8188
This decimal value (or uint32_t or w/e) would then be stored in a variable and output. I can do this for a single case, but am having a hard time writing code where start bit and number of bits are variables into a function or block of code...
I've tried using memcpy, but this is only byte addressable.
I would appreciate any feedback!