Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: question about importance of branchless code for speed

Author: Daniel Clausen

Date: 09:29:20 04/09/03

Go up one level in this thread


On April 09, 2003 at 12:12:22, Robert Hyatt wrote:

>if (wtm == 1)
>  score+=bonus1
>else
>  score+=bonus2;
>
>You could turn that into:
>
>score+=wtm*bonus1 + (wtm^1)*bonus2;
>
>the new code does more work, but has no branch to mispredict.

And it's soo incredibly readable. :p I know this is not the discussion here, but
I wanted to point the out nevertheless. :)

Sargon



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.