Jun 03, 2019
06:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 03, 2019
06:26 AM
Hello,
I want to define a union with 32 Bit.
union{
uint8_t x [4];
uint32_t y;
};
In one case I work with "uint32_t y" and in the other with "uint8_t x [4]".
My problem is that uint32_t is little endian but I need big endian. How can I change it?
I use Dave 4 and a XMC 4700 Controller.
Thanks for your help
S.H.
I want to define a union with 32 Bit.
union{
uint8_t x [4];
uint32_t y;
};
In one case I work with "uint32_t y" and in the other with "uint8_t x [4]".
My problem is that uint32_t is little endian but I need big endian. How can I change it?
I use Dave 4 and a XMC 4700 Controller.
Thanks for your help
S.H.
- Tags:
- IFX
1 Reply
Jun 03, 2019
02:51 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 03, 2019
02:51 PM
Hi,
XMC4 is implemented as little endian processor. Therefore any uint32_t variable would be stored in memory in little endian format.
You can use the __REV() intrinsic to store a number in a uint32_t in big endian format.
Regards,
Jesus
XMC4 is implemented as little endian processor. Therefore any uint32_t variable would be stored in memory in little endian format.
You can use the __REV() intrinsic to store a number in a uint32_t in big endian format.
Regards,
Jesus