Computer Chess Club Archives


Search

Terms

Messages

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

Author: Normand M. Blais

Date: 14:27:58 07/04/03

Go up one level in this thread


On July 04, 2003 at 15:45:46, Gerd Isenberg wrote:

>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

You are right. Thank you for the hint.

Normand




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.