Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Simple optimization question

Author: Tord Romstad

Date: 05:44:50 01/09/04

Go up one level in this thread


On January 09, 2004 at 07:52:12, Ratko V Tomic wrote:

>>if(x) y += 20;
>>
>>Would it then be advantageous to rewrite the code like this?
>>
>>y += (!(!x))*20;
>
>No, since the compiler will produce jumps anyway (you need to enable the
>compiler's assembly listing and check the output). The extra multiply would make
>the second statement slower.

Thanks.  That seems to imply that my idea is ineffective, at least if the
answer is architecture-independent.  My engine is developed on a Mac, although
it also compiles and works reasonably well on Wintel machines.

Tord




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.