How do you decide when do you use which jump statement…statements such as JG JNLE JNC can do the same job how do you differentiate them?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
J(E)CXZ is used generally when you’ve got a count value in the CX register that you’re using to limit iterations in loops.
JMP is an unconditional jump used to exit loops, enter APIs in a non-CALL based interface, build jump tables, etc.
Conditional jumps are used to change your thread of execution based upon conditions of previous calculations. There are a lot of synonyms (documented in the link I just provided) and the synonyms are usually for obvious reasons. JAE, for example, means “Jump if Above or Equal”. This is a synonym for JNC, which means “Jump if No Carry” and JNB, which means “Jump if Not Below”. Which you use is purely a matter of making your code understandable to the reader:
This is actually a classic problem in language design: do you make lots of aliases, making the syntax more complicated in favour of clarifying semantics, or do you restrict your “keywords” (opcode mnemonics here) at the expense of semantics being harder to read?