Author: Gerd Isenberg
Date: 07:47:42 06/02/04
Go up one level in this thread
On June 02, 2004 at 09:14:38, Gerd Isenberg wrote:
>One more note ...
>
>The same optimization occurs with an int-array, if one is aware of the q-value
>range, eg. if q values are in the range from 0..15 it is only necessary to shift
>by four. Considering OOE and register renaming, could one beat that with
>assembly?
Ok, your initial rcl-one is only 48 bytes versus 98 of the C-Version.
It is slightly faster on a P4 2GHz, but i fear not on AMD, i will try later.
Somthing like 11.2ns versus 11.8ns.
int pack2bitsAsm(int q[8])
{
__asm
{
mov ecx, [q]
xor edx, edx
xor eax, eax
cmp edx, [ecx+7*4]
rcl eax,1
cmp edx, [ecx+6*4]
rcl eax,1
cmp edx, [ecx+5*4]
rcl eax,1
cmp edx, [ecx+4*4]
rcl eax,1
cmp edx, [ecx+3*4]
rcl eax,1
cmp edx, [ecx+2*4]
rcl eax,1
cmp edx, [ecx+1*4]
rcl eax,1
cmp edx, [ecx+0*4]
rcl eax,1
}
}
>
>I guess your intention is to get an 8-bit index of all possible surrounding king
>squares, considering board symmetry (back,front,luv,lee) and to get information
>on escape squares, eg. whether there is only one square, or two squares on one
>coomon ray to escape - nice!
>
>May be an alternative solution to frickle an inner six square occupied state
>from a ray to index precalculated attack tables without rotated bitboards,
>specially if your piececodes are already negative, but empty is null ;-)
>
>Cheers,
>Gerd
>
>
>int pack2bits(int q[8])
>{
> int bitfield;
> bitfield = ((-q[7]>>4) & 128)
> | ((-q[6]>>4) & 64)
> | ((-q[5]>>4) & 32)
> | ((-q[4]>>4) & 16)
> | ((-q[3]>>4) & 8)
> | ((-q[2]>>4) & 4)
> | ((-q[1]>>4) & 2)
> | ((-q[0]>>4) & 1);
> return bitfield;
>}
>
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.