Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Update on VC++6.0 compiler problem

Author: Gerd Isenberg

Date: 12:45:46 07/04/03

Go up one level in this thread


Norman,

another hint, even if your routine seems not to be performance critical.
Try to avoid unnecessary branches.

...
   if (sq >= 0 && sq <= 63) return sq;
   return -1;
}

This implies, that you need a further "if (sq != -1)" outside the function.
So why not skipping the if statement inside the function at all and only use the
if statements outside.

The compiler should optimize
   if (sq >= 0 && sq <= 63)

to somthing like this
   if (((unsigned)sq) <= 63)

or like this
   if ( (sq & ~63) == 0 )

Regards,
Gerd




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.