From: kurt DOT skauen AT funcom DOT com (Kurt Skauen) Newsgroups: comp.os.msdos.djgpp Subject: Re: some advice required Date: Thu, 27 Feb 1997 16:43:41 GMT Organization: Funcom production A/S Lines: 33 Message-ID: <857061715.836060@araga.funcom.com> References: Reply-To: kurt DOT skauen AT funcom DOT com NNTP-Posting-Host: araga.funcom.com Cache-Post-Path: araga.funcom.com!unknown AT pcshare44 DOT funcom DOT com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Robert Humphris wrote: >I think that they are both the same! The speed ups with maths occur at >multiplicaton/division time >when you do the old bit shifts (<< & >>) instead. > >If this is wrong, will some one please tell me, as I don't want to be >labouring upder misinformation > >Rob Humphris This is normaly not true when programming in C, or C++ since most compiler will optimize all division/multiplication with constants that is a power of two to shift's anyway so foo = bar / k; where bar is variable integer, and k is a constant which is a power of two will be converted into: foo = bar >> log(k) / log(2); So using shiftings for the sake of optimaization is normaly wasted, and often leads to less self-explaining code. =/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\= How to kill a daemon: for(;0;) Kurt. Programmer Funcom/R&D The above expressions is not ment to represent Funcom.