assembly - Single Instruction Alternates of code snippets -
what'll single instruction alternates of following code snippets. have been trying hours , can't figure them out
cmp ebx,eax jne x1 mov ebx,ecx jmp x2 x1: mov eax,ebx x2pushf mov bh,ffh cmp bl,0 jl x1 not bh x1: popfbt ax,15 jc x1 , eax,0000ffffh jmp x2 x1: or eax, ffff0000h x2:
please provide explanation too.
thanks
- looks
cmpxchg ebx, ecx.if (eax == ebx) ebx = ecx else eax = ebx - that gives
0ffhinbhifblnegative, or00hotherwise. such that's sign extending, ie.movsx bx, bl - that's same, it's sign extending
axtesting sign bit directly, ie.movsx eax, ax. note doesn't affect flags opposed code snippet.
Comments
Post a Comment