Assembly is real open source .




bswap

Usage: BSWAP reg32 Modifies flags: none

Changes the byte order of a 32 bit register from big endian to little endian or vice versa. Result left in destination register is undefined if the operand is a 16 bit register.

Byte Swap

 

BSWAP reg32 ; o32 0F C8+r [486]

 

BSWAP swaps the order of the four bytes of a 32-bit register: bits 0-7 exchange places with bits 24-31, and bits 8-15 swap with bits 16-23. There is no explicit 16-bit equivalent: to byte-swap AX, BX, CX or DX, XCHG can be used. When BSWAP is used with a 16-bit register, the result is undefined.

 

EXAMPLE:


main:

mov eax  ,   01111_0000    ; eax = 11110000b



bswap   eax        ; eax = 15d


ret