You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
neg changes CF (if operand = 0, CF = 0) , OF, SF, ZF, AF, and PF.
Usually, js will do the trick except for one case: if rax is equal to the smallest signed integer. It is because the range of 64-bit integers is asymmetric: -2^64 ... 2^64 - 1. When rax is the smallest negative integer, its 2 complement (computed by neg) is the same and as the result we get stuck in a loop. Let's study these two examples:
Normal case: rax = -10
label: ; rax = -10negrax ; rax = 10, CF, PF, AF setjs label ; OK, no jump
label: ; rax = -2^64negrax ; rax = -2^64, CF, PF, SF, OF are setjs label ; `rax` is still negative and won't change its sign.
Now we are stuck performing neg (which has no effect) and js till the end of the world.
However, notice, that both SF and OF are set in this case. This is the exact situation when jl will prevent us from being stuck in a loop.
jl
responds to SF != OF.js
seems to work as well and is a "logical" choice.Is
jl
preferred for any reason?The text was updated successfully, but these errors were encountered: