Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ncar!mephisto!udel!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: a style question Message-ID: <26786@mimsy.umd.edu> Date: 1 Oct 90 09:57:47 GMT References: <7341@darkstar.ucsc.edu> <1990Sep30.050655.13212@zoo.toronto.edu> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 14 [on the test `x < 100' vs `x != 100' in a for loop] In article davis@pacific.mps.ohio-state.edu ("John E. Davis") writes: >Which generates faster code? It seems to me that it is easier to tell if >two values are unequal than to tell if one is greater than the other. Not really. The easy comparisons are against 0; the others are generally a bit harder. (A comparison for `x == y' can be done in more ways than one for `x < y', but this is not much of a recommendation.) Look at the test instructions on the current crop of fast CPUs for a demonstration. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris