Arm/bswap

From ASMBits

arm/shiftlPrevious

When communicating multi-byte (hword or word) values between machines of different endianness, it is sometimes necessary to swap the byte ordering. Write a function that will reverse the byte ordering in a 32-bit word. (Note that only bytes are swapped. The 8 bits within each byte are still in the same order.)

The function has one parameter: The input number.

Expected solution length: Around 2 lines.

Sample Input

0x11223344

Sample Output

r0=0x44332211

The rev instruction may be useful.

Write your solution here

Upload a source file...