Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 2
    Your point is not well made here because for one thing if (foo) and if (foo != 0) should generate the same code, and secondly, you're showing that the assembly language you're using in fact has explicit boolean operands and tests for them. For instance jz means jump if zero. In other words if (a == 0) goto target;. And the quantity is not even being tested directly; the condition is converted its a boolean flag which is stored in a special machine word. It's actually more like cpu.flags.zero = (a == 0); if (cpu.flags.zero) goto target; Commented May 16, 2013 at 17:02
  • No Kaz, the older CPU's did not work like that. The jz/jnz can be performed without doing a comparison instruction. Which was kind of the point of my whole post really. Commented May 19, 2013 at 2:04
  • 2
    I didn't write anything about a comparison instruction. Commented May 19, 2013 at 2:35
  • Can you cite a processor that has a jz instruction but no jnz? (or any other asymmetric set of conditional instructions) Commented Nov 9, 2016 at 16:58