bswap

8086 and later

Byte Swap

bswap reg32 | bswap reg64 | bswap ax | bswap cx | bswap dx | bswap bx

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.

Loading...

Forms

Every form of bswap the assembler accepts, from NASM's own instruction table. The second column is the processor that introduced the form; a badge marks a form that needs an extension, that is lockable, or that long mode dropped.

FormSinceNotes
bswap reg32486
bswap reg64x86-64long
bswap ax8086
bswap cx8086
bswap dx8086
bswap bx8086