Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: a question about speed difference that I do not understand

Author: Uri Blass

Date: 11:24:53 12/05/01

Go up one level in this thread


On December 05, 2001 at 14:11:34, Dieter Buerssner wrote:

>On December 05, 2001 at 13:55:19, Ed Schröder wrote:
>
>>Well, I never leave it up to the compiler to decide things for me but that's
>>easy becausese my background is assembler and my way of programming in C++
>>still is as close to assembler as possible. In your case I would program it
>>as follows:
>>
>>static char direction [65*65];       // create an area big enough, using char
>
>For zero based squares, this data structure is too big. 64*
>64 is enough. Also, becuase 64^2 is a power of two, it may give better alignment
>for following data.
>
>>To access the table:
>>
>>int x,y, char result;
>>
>>result = direction [x<<6][y];
<snipped>
>This is an syntax error. You probably mean direction[x<<6+y].

Is there an advantage to use x<<6|y or it is the same?

From human's point of view + seem to be more complex then | but I do not know
how the computer does it.

I have also another question

Is there a faster way to the following when s can be 0 or 1 and directsee is an
array of 32 bit integers?

I turn on 1 bit and turn off another bit and I thought that maybe it is possible
to do it faster(I use it for my attack array to tell my computer that side s see
target from some direction when the other side does not see target from the same
direction).

directsee[target]|=(1<<(s<<4));
directsee[target]&=~(1<<((1^s)<<4));

Uri



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.