Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference in jump statements in assembly programming

Tags:

x86

assembly

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?

like image 946
ruchir patwa Avatar asked Dec 12 '22 23:12

ruchir patwa


1 Answers

The jumps you mention are all jumps on condition code values.

JG and JNLE are the same: they have the same opcode and do the same thing. One is "jump if greater than", and the other is "jump if not less than or equal to". Think about it. These are signed branches, that means they take the sign flag into account when determining whether to branch.

JNC means "jump if no carry". It will jump if the carry flag is not set. Carry is often used to detect arithmetic overflow, for example when adding 2 unsigned integers.

like image 101
Richard Pennington Avatar answered Feb 01 '23 23:02

Richard Pennington