Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!hsdndev!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.c Subject: Re: micro-optimizing loops (was Help with casts) Message-ID: <15396:Feb2419:32:5891@kramden.acf.nyu.edu> Date: 24 Feb 91 19:32:58 GMT References: <339@smds.UUCP> <414@ceco.ceco.com> <10191@dog.ee.lbl.gov> Organization: IR Lines: 16 What Chris doesn't point out is that i = blah; do { ... } while (--i); will compile to the optimal code on most machines under most compilers, whether they have condition codes or not, whether they have exposed jump delays or not, and whether the optimizer is on or off. I don't know any machines where this will produce worse code than any other expression of the loop. ---Dan