Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: sliding attacks in three inlines

Author: Tord Romstad

Date: 23:48:28 04/15/04

Go up one level in this thread


On April 15, 2004 at 17:47:40, Sune Fischer wrote:

>On April 15, 2004 at 15:40:30, Gerd Isenberg wrote:
>
>>>But since the relation between bb and 0x88 is:
>>>0x88 = bb shl 1-(bb and 7), you can also use it for bb.
>>>
>>>Tony
>>
>>Nice trick to save the additional and of the rank ;-)
>
>Same trick, only on the upper 3 bits:
>0x88 = bb + (bb & ~7)

I use the following two macros:

#define Expand(x) (((x)<<1)-((x)&7))
#define Compress(x) (((x)&7)|(((x)&120)>>1))

The Expand() macro is, as far as I can see, identical to Tony's suggestion.
But is there a better way to write the Compress() macro?  My solution looks
quite complicated, and it is hard to believe that it is optimal.

Tord




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.