H
Hetal
Hey all ...
I have a question.
I have a structure as below:
typedef struct
{
UInt8 data1;
UInt8 data2_4b : 4,
data2_nxt4b : 4;
UInt16 data3;
} data_T;
assuming ..
UInt8 = unsigned char
UInt16 = unsigned short int
My code is running on a Windows system (Little Endian)
When I write code to store data in this structure and view the memory
windows in Visual Studio ... this is wht I get.
when I set data2_4b = 7; and data2_nxt4b = 3; the memory window shows
....
0011 0111 (0x37)
Shouldn't I be seeing 0111 0011 (0x78). Thus looks like when splitting
the byte .. the processor is storing the first 4 bits in the least
significat half byte and the second four bits in the most significant
half byte.
Is this a processor specific thing ? That is will this code execute
differently on diffeent systems ?
thanks,
Hetal.
I have a question.
I have a structure as below:
typedef struct
{
UInt8 data1;
UInt8 data2_4b : 4,
data2_nxt4b : 4;
UInt16 data3;
} data_T;
assuming ..
UInt8 = unsigned char
UInt16 = unsigned short int
My code is running on a Windows system (Little Endian)
When I write code to store data in this structure and view the memory
windows in Visual Studio ... this is wht I get.
when I set data2_4b = 7; and data2_nxt4b = 3; the memory window shows
....
0011 0111 (0x37)
Shouldn't I be seeing 0111 0011 (0x78). Thus looks like when splitting
the byte .. the processor is storing the first 4 bits in the least
significat half byte and the second four bits in the most significant
half byte.
Is this a processor specific thing ? That is will this code execute
differently on diffeent systems ?
thanks,
Hetal.