Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: when a & is faster than a && ?

Author: Antonio Dieguez

Date: 21:41:05 09/20/01

Go up one level in this thread


hi Miguel!

thanks for the tip.

Duerme bien y cuidate.


>This might not be the answer to your question but it could be useful:
>
>sometimes, if you are willing to sacrifice readibility and speed is critical
>you can replace
>
>if (a==b && c==d) {
>	do_something();
>}
>
>by
>
>if (0 == ((a-b) | (c-d))) {      /* avoids mispredictions caused by && */
>	do_something();
>}
>
>it could be faster in some cases. Of course, is prone to bugs if you use
>it everywhere.
>
>Regards,
>Miguel
>



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.