Fast Nibble swap | Assembler/80286 |
rol al,4To swap all four pairs of nibbles:
; ; fast nibble swapping ; ; input: ; eax = word to nibble swap ; ; output: ; eax = nibble swapped word ; ; destroys: ; edx ; flags ; mov edx,eax shr eax,4 and edx,0f0f0f0fh shl edx,4 and eax,0f0f0f0fh or eax,edx