It's pretty common for compilers to have builtin intrinsic functions for processor features, but I'm having trouble finding them. Is there one to get at the 'REV' (reverse byte order of a word) instruction in ARM?
Where can I find the list of builtin functions?
There is a more 'portable' form that is available on all architectures. It is
__builtin_bswap32
. For example the compiler explorer has,Giving,
This is better than
__builtin_rev
would be as it will only be available on certain ARM targets (and certainly only ARM CPUs). You can use__builtin_bswap32
even on PowerPC, x86, etc.