Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: question about branchless code

Author: Russell Reagan

Date: 12:35:34 02/27/03

Go up one level in this thread


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 );



This page took 0.01 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.