Author: Matt Taylor
Date: 08:02:11 02/28/03
Go up one level in this thread
On February 27, 2003 at 15:35:34, Russell Reagan wrote:
>On February 27, 2003 at 07:27:40, Vincent Diepeveen wrote:
>
>>do {
>> int tempty=info[target]-EMPTA;
>> if( !tempty ) // good compilers do this branchless
>> target += 8;
>>} while( target < 64 );
>
>Does the compiler change it to something like this?
>
>do {
> int tempty=info[target]-EMPTA;
> target += 8 * (tempty & ~0);
>} while( target < 64 );
>
>Or...
>
>do {
> int tempty=info[target]-EMPTA;
> target += 8 * (!tempty);
>} while( target < 64 );
Not VC which is what he's using. However, with slight modification you can.
Change the line to this:
target += ((info[target] == EMPTA) * 8);
VC will correctly use setcc (no branch) for the boolean comparison, shift the
result left by 3, and add it to target. I don't recall what Uri's function
looked like now, but that doesn't sound like what he was doing...
-Matt
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.