Is there a way to get the REV command (reverse word byte order) in ARM?
There is a more βportableβ form available for all architectures. This is __builtin_bswap32 . For example, the compiler explorer ,
unsigned int foo(unsigned int a) { return __builtin_bswap32(a); }
To give
foo(unsigned int): rev r0, r0 bx lr
This is better than __builtin_rev , as it will be available only for specific ARM purposes (and, of course, only for ARM processors). You can use __builtin_bswap32 even on PowerPC, x86, etc.
artless noise
source share