Author: Uri Blass
Date: 15:16:14 07/11/03
Go up one level in this thread
On July 11, 2003 at 10:07:55, Gerd Isenberg wrote:
>On July 11, 2003 at 08:41:46, Uri Blass wrote:
>
>>On July 11, 2003 at 08:04:48, Gerd Isenberg wrote:
>>
>>>On July 10, 2003 at 23:04:04, Uri Blass wrote:
>>>
>>>>I have in movei cases when I have 2 lines like the following when s can be only
>>>>0 or 1 and 128 can be every power of 2 that is less than 2^16
>>>>
>>>>directsee[target]|=(128<<(s<<4));
>>>>directsee[target]&=~(128<<((1^s)<<4));
>>>>
>>>>My question is if there is a way to optimize it.
>>>>
>>>>There are also case when I know s and may have something like the following:
>>>>
>>>>directsee[target]|=64;
>>>>directsee[target]&=~(64<<16);
>>>>
>>>>I do not know if there is a way to do it faster(I expect a smart compiler to
>>>>optimize it by itself).
>>>>
>>>>Uri
>>>
>>>Hi Uri,
>>>
>>>directsee[target] |=(128<<(s<<4));
>>>
>>>assuming directsee is 32 bit array:
>>>
>>>s ==> {0,1}
>>>s << 4 ==> {0,16}
>>>0x00000080 << (s << 4) ==> {0x00000080, 0x00800000}
>>>
>>>what about a union of directsee with one 32 bit int and two short 16-bit ints
>>>and to write:
>>>
>>>directsee[target].short16[s] |= 128;
>>>
>>>Cheers,
>>>Gerd
>>
>>I will try it
>>
>>I understand that
>>directsee[target]&=~(128<<((1^s)<<4)) should be translated to
>>directsee[target].short16[1^s]&=~128;
>>
>>The question is if the following is the fastest or I can do it in a faster way:
>>
>>directsee[target].short16[s] |= 128;
>>directsee[target].short16[1^s]&=~128;
>>
>>
>>Uri
>
>I guess that is quite optimal, one c-statement should be translated to one (or
>two) asm-statements, like this:
>
>; target = edi; s = ebx
>or word ptr [_directsee + 4*edi + 2*ebx], 0x0080
>
>xor ebx, 1
>and word ptr [_directsee + 4*edi + 2*ebx], 0xff7f
>
>Gerd
Thanks.
My problem is now how to implement it without bugs because I have hundreds of
places with directsee[target]
replacing hundreds of lines without debugging in the middle is for me a way that
I can be almost sure about new bugs.
It seems that I need first to replace every
directsee[...] by directsee[...].uint32 and only later to replace the .uint32 by
.short16;
The problem is that I do not know even how to do the last thing automatically.
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.