Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: sliding attacks in three inlines

Author: Tony Werten

Date: 00:22:55 04/16/04

Go up one level in this thread


On April 16, 2004 at 02:48:28, Tord Romstad wrote:

>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.

bb = (x88+(x88 and 15)) shr 1

Tony

>
>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.