endian

17 Dec 2010

Hello, is there a compiler macro to switch the endian of a variable ?

Peter

17 Dec 2010

CMSIS provides some macros to access the Cortex-M3 instructions for that.

uint32_t __REV (uint32_t value)		Reverse byte order in integer value.
uint32_t __REV16 (uint16_t value)	Reverse byte order in unsigned short value. 
sint32_t __REVSH (sint16_t value)	Reverse byte order in signed short value with sign extension to integer.
uint32_t __RBIT (uint32_t value)	Reverse bit order of value

More here.

18 Dec 2010

Thanks,

the REV() is working.

Peter