Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Move generation question for the big boys

Author: J. Wesley Cleveland

Date: 13:28:40 09/15/01

Go up one level in this thread


On September 15, 2001 at 15:23:29, Bruce Moreland wrote:

>On September 15, 2001 at 14:30:40, Vincent Diepeveen wrote:
>
>>On September 15, 2001 at 11:14:36, Sune Fischer wrote:
>
>>>   bb ^= mask[to_square];        // remove the bit
>>>
>>>   movelist[++counter].from=from_square;
>>>   movelist[counter].to=to_square;
>>>   movelist[counter].piece=QUEEN;
>>>   movelist[counter].capturedpiece=enemy.piece[board.id[to_square]];
>>
>>this looks ugly. Using a pointer here would be way faster.
>
>Not necessarily.  If the "counter" variable is enregistered by the compiler, you
>end up with about the same thing as if you used a pointer, but it also depends
>upon how large the elements of "movelist" are.
>
>Using pointers will usually help the compiler out, because it can just indirect
>through a value, rather than having to deal with scaling the value and adding it
>to a constant.  But in some circumstances, scaling it and adding it to a
>constant is free.

A good compiler should optimize this anyway.



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.