hii
i want to swap the 1st bit with the 3rd
like
123
321
only in bits
this what i have in mind
instead of shr can be use bt this wont destory the 2nd register
another one
EDIT:
found another one in the board
any more ways ? ideas?
bye
thanks
eko
i want to swap the 1st bit with the 3rd
like
123
321
only in bits
this what i have in mind
shr ecx, 1
rcl eax, 1
shr ecx, 1
rcl eax, 1
shr ecx, 1
rcl eax, 1
instead of shr can be use bt this wont destory the 2nd register
another one
test ah,4
jz @F
test ah,1
jnz _changed
xor ah,4 or 1
jmp _changed
@@:
test ah,1
jz _changed
xor ah,4 or 1
_changed:
mov dl,ah
and ah,1 or 4
xor ah,1 or 4
jz _nochanged
xor dl,1 or 4
_noneed:
EDIT:
found another one in the board
mov esi, 01110011010100010110001001000000b
shl ecx, 2
shr esi, ecx
and esi, 111b
any more ways ? ideas?
bye
thanks
eko
Nexo, posted a three instruction bit exchange here:
http://www.asmcommunity.net/board/viewtopic.php?t=6990&highlight=exchange
Here is code for specific case requested:
BIT0 <= BIT0 xor (BIT0 xor BIT2)
BIT2 <= BIT2 xor (BIT0 xor BIT2)
...just like the register swap trick. :)
http://www.asmcommunity.net/board/viewtopic.php?t=6990&highlight=exchange
Here is code for specific case requested:
test eax, 101y
jnp @F
xor eax, 101y
@@:
In English it would be stated: reverse bits when not the same.
BIT0 <= BIT0 xor (BIT0 xor BIT2)
BIT2 <= BIT2 xor (BIT0 xor BIT2)
...just like the register swap trick. :)