<<< Memory-to-memory exchange | Index | Extending Signed and Unsigned Integers >>> |
The XCHG instruction is useful for conversion of 16-bit data between little endian and big endian forms.
xchg al, ah
For example, the following XCHG converts the data in AX into the other endian form.
Pentium provides BSWAP instruction to do similar conversion on 32-bit data:
BSWAP 32-bit register
Note: BSWAP works only on data located in a 32-bit register.
BSWAP swaps bytes of its operand. For example,
bswap eax
Result of BSWAP EAX
<<< Memory-to-memory exchange | Index | Extending Signed and Unsigned Integers >>> |