I understand. I don't even need a computer to do that :-) The "return" was just to discourage the optimizer to throw away all the code because I didn't use the result.
The thing that kept me awake briefly was whether the optimizer would recognize that the shortcut and code a single compare with two branches using the CC. I suppose my next attempt would have been a case statement using sign() Rob On 23 October 2013 12:25, robin <robi...@dodo.com.au> wrote: > From: "Rob van der Heij" <rvdh...@gmail.com> > Sent: Wednesday, October 23, 2013 8:12 PM > > > > Since the machine architectures that came to mind all have this 3-state >> result after comparison, I expected the compiler to take advantage of it >> when I write something like >> if ( j < k ) m = -1; >> else if (j > k) m = 1; >> else m = 0; >> return m; >> > > It is sufficient to write: > return (sign(j-k) ); >