P
Polaris431
I have a buffer that holds characters. Four characters in a row
represent an unsigned 32 bit value. I want to convert these characters
to a 32 bit value. For example:
char buffer[3];
buffer = "aabbccdd";
where aa is the LSB and dd is the MSB.
If I define a unsigned 32 variable:
uint value;
I want value to be equal to 0xaabbccdd.
I thought of making a pointer to point to the address of the value
variable and copy each character into the location but I can't figure
out how to do that, if it is even possible at all.
I had another solution of converting each character to a byte and
shifting it into the value variable but I want to avoid shifting due to
the overhead required for shifting on my target system.
Any suggestions?
Thanks
represent an unsigned 32 bit value. I want to convert these characters
to a 32 bit value. For example:
char buffer[3];
buffer = "aabbccdd";
where aa is the LSB and dd is the MSB.
If I define a unsigned 32 variable:
uint value;
I want value to be equal to 0xaabbccdd.
I thought of making a pointer to point to the address of the value
variable and copy each character into the location but I can't figure
out how to do that, if it is even possible at all.
I had another solution of converting each character to a byte and
shifting it into the value variable but I want to avoid shifting due to
the overhead required for shifting on my target system.
Any suggestions?
Thanks