I have an unsigned char (8-bits wide, naturally) that contains 8 flag bits.
Example:
unsigned char flag1:1,
flag2:1,
flag3:1,
flag4:1,
flag5:1,
flag6:1,
flag7:1,
flag8:1;
I would like to take this unsigned char and convert it into a bit array where each bit represents a flag. Pretty much like representing that unsigned char in its true binary form.
Similar example to what im looking for:
The character 'a' is 61 in hex which is 0110 0001 in binary. If I were to pass the char 'a' into this function, it would return to me a bit pointer (or an 8 bit array) starting with the first address of it's binary form.
There should be an easy way of doing this. No?