Path: chuka.playstation.co.uk!news From: "Jon Prestidge (Jon@surfed.to)" Newsgroups: scee.yaroze.freetalk.english Subject: Re: Daft Question [long] Date: Mon, 27 Aug 2001 21:30:17 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 53 Message-ID: <9meajl$1sb17@www.netyaroze-europe.com> References: <9loc6a$p3k2@www.netyaroze-europe.com> <9loeu8$p3k3@www.netyaroze-europe.com> <01c1297e$8cb6e8a0$LocalHost@pal-s-omnibook> <9lrqqf$3j63@www.netyaroze-europe.com> <01c129ca$a5a6f700$d81fe4d5@pal-s-omnibook> <9m1d9c$b2i7@www.netyaroze-europe.com> <01c12ceb$fba64880$9709e4d5@pal-s-omnibook> <9m9c88$ioj5@www.netyaroze-europe.com> <01c12edc$cc2bf440$991fe4d5@pal-s-omnibook> <9me1g1$1sb13@www.netyaroze-europe.com> NNTP-Posting-Host: host213-122-71-74.btinternet.com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 > I have absolutely no idea how fast an integer divide is ... it's only one CPU instruction... it may take an extra clock cycle or two longer to execute than a logical shift operation for example, but it's still very, very quick. > cant be any slower then the several if's .... one integer divide should be a lot quicker that several IFs. The Risc chip can only compare against zero so unless you're IF compares a value against zero the IF statment will be two CPU instructions ( a subtract and a compare-and-branch ). A big over head is the loading and unloading of variables to CPU registers from memory and back again...if you can arrange small performance critical routines to use just a few variables (or just two if you can manage it) then it's a lot quicker because there's more chance of the variable staying in a CPU register and not being loaded back and forth to memory. Jon John ( QuietBloke ) wrote in message news:9me1g1$1sb13@www.netyaroze-europe.com... > aye.. To be honest I have absolutely no idea how fast an integer divide is. > Im just kinda assuming it cant be any slower then the several if's and > shifts' etc of the other solution. > Anyway.. I shall keep you informed.. and thanx for the initial code.. was a > real time saver. > > Cheere > John ( Quietbloke ) > > "pal" wrote in message > news:01c12edc$cc2bf440$991fe4d5@pal-s-omnibook... > > I agree that this new method is far more elegant than the shift's one, but > > are you sure it'll be quick enough? It uses three divide's, which I > believe > > will take a lot of time, won't they? > > > > Anyway, please let us know the results and your final implementation, as > > this angle problem is a recurrent one... > > > > > > pal > > > >