Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: speed question about arrays

Author: Tim Foden

Date: 22:11:35 02/19/04

Go up one level in this thread


On February 19, 2004 at 18:58:47, José Carlos wrote:

>On February 19, 2004 at 16:57:39, Tim Foden wrote:
>
>>If you converted the coordinates to 0x88 coordinates, you only need a 256 byte
>>lookup table.
>>
>>A macro to do the conversion from the 64 square system would be...
>>
>>#define TO88(sq) ((sq) + ((sq) & 0x38))
>
>  Hi Tim. Your conversion is probably faster than mine. Here's the best I could
>figure out (in Averno):
>
>#define Trad0x88(x)	((((x)&120)<<1)|((x)&7))	// 64 -> 0x88
>#define	Trad64(x)	(((x&240)>>1)|(x&7))		// 0x88 -> 64

There's also a slightly faster way of doing your second one, using a similar
trick to the one used in the first one...

#define FROM88(sq) (((sq) + ((sq) & 0x07)) >> 1)

Cheers, Tim.



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.