From: Vic Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP division optimisations Date: Mon, 13 Jul 1998 20:32:05 -0400 Organization: Communications Accessibles Montreal, Quebec Canada Lines: 13 Message-ID: <35AAA705.1BDE@cam.org> References: <35AA8994 DOT 3FC1 AT virgin DOT net> <6oe4in$1m7$1 AT rosenews DOT rose DOT hp DOT com> NNTP-Posting-Host: dialup-749.hip.cam.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Andrew Crabtree wrote: > > >on long integers. In the source code I used x /= 2; y /=2; for clarity, > >on the assumption that the compiler would replace these operations with > >shifts.However, it seems this isn't a valid assumption. Replacing the code > with > >x >>= 1; y >>= 1; made a large speed up. > > Just a guess, but maybe GCC only does that optimization on unisignd > integers, not signed integers. it's true, I checked this. I put "unsigned" in front of the variables and the 2 loops performed the same (2.74 seconds)