Author: Jaime Benito de Valle Ruiz
Date: 16:35:49 06/21/04
Go up one level in this thread
>Here is the code: > >int phasewhite=31-valpieces[DARK]; >int phaseblack=31-valpieces[LIGHT]; >if (phasewhite<0) > phasewhite=0; >if (phaseblack<0) > phaseblack=0; > >phasewhite=(phasewhite*256+15)/31; >phaseblack=(phaseblack*256+15)/31; > >Uri Nothing to do with your question, but at least in Athlons, divisions are very slow, so you could speed up your code by using multiplications instead: phasewhite=(phasewhite*541200+31710)>>16; This line is NOT exactly the same as yours. It has 3 drawbacks: 1) The value of phasewhite cannot be very high (3967, to be precise) 2) One out of 10 times you'll get 1 more than what it should be (eg. 198 instead of 197), but if you can live with that, these lines should be MUCH MUCH faster. 3) What the hell are those 2 numbers? (not easy to read, uh?) Now everything depends on how often this function is called, of course. If you call them all the time, maybe you'll see a tiny improvement in the nps. Give it a try and see what happens. Good luck, Jaime
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.