Say I have an array of unsigned char
of 6 bytes.
And some function modifies value in it. How would I retrieve modified values say from 0-19bit
?
void my_func()
{
unsigned char tempVal[6] = { 0,0,0,0,0,0}
unsigned char* temPtr = &temVal; // Say I am using pt
int newVal;
// call external function to modify value
// fun below assign new values to tempVal[0].. till tempVal[5].
void someFuncTomodifyVal( tempPtr );
// Now I want values from say 1st19bits
// how would I achieve that? I know I have to use And condtion with 7FFFF
// so say somthing like
newValue = *tempPtr & 0x7FFFF // but then *tempPtr will give me first byte only?
}
So my question is what should I give instead of *tempPtr
to get 1st 19 bits
example of
void someFuncTomodifyVal( unsigned char m[] )
{
m[0] = 'some value retrieve from other funct'
m[1] = ' values based on some cal'
m[2] = ' values based on some cal'
}