An if()
statement means "skip this if the condition is not true".
If the condition is true, you want execution to fall-through into the if
body, and if it's false you want execution to jump over the if
body.
Thus, the obvious / literal way to compile an if
is with a jcc on the inverse condition, like jnl
. (Optimized code could certainly do much better for those highly-related if/else blocks, like subtract and conditional negate.)
If you wanted to use jl
, you have to put the if
-body out-of-line, maybe after the ret
at the end of the function, and then jump back from it.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…