M
Mehta Shailendrakumar
Hi,
I am sending this question again as new question rather than reply to old
question
Please refer below:
struct raw_data
{
unsigned char x;
unsigned char y;
};
union full_data
{
unsigned int actual_value; //int size is 2 bytes
struct raw_data A; //2 chars means 2 bytes
};
I have two compilers for two different controllers, one with little endian
and one with big endian support.
The number "actual_value" is different in both cases because of different
endian-ness.
The actual raw_data structure I use is bigger than this example(8 bytes) and
the data is
interpreted in a structure having 4 integers inside the union.
I would like to know fastest way to do little to big ENDIAN conversion or
vice versa.
I presently interchange two successive bytes (x and y here in example)
before
accessing actual_value for porting purpose.
Last but not the least, I am porting from C16X controller to X51 and using
Keil compiler
for both the versions.
Thank you for the help.
Regards,
Shailendra
I am sending this question again as new question rather than reply to old
question
Please refer below:
struct raw_data
{
unsigned char x;
unsigned char y;
};
union full_data
{
unsigned int actual_value; //int size is 2 bytes
struct raw_data A; //2 chars means 2 bytes
};
I have two compilers for two different controllers, one with little endian
and one with big endian support.
The number "actual_value" is different in both cases because of different
endian-ness.
The actual raw_data structure I use is bigger than this example(8 bytes) and
the data is
interpreted in a structure having 4 integers inside the union.
I would like to know fastest way to do little to big ENDIAN conversion or
vice versa.
I presently interchange two successive bytes (x and y here in example)
before
accessing actual_value for porting purpose.
Last but not the least, I am porting from C16X controller to X51 and using
Keil compiler
for both the versions.
Thank you for the help.
Regards,
Shailendra