Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Macros versus Inline

Author: Russell Reagan

Date: 06:54:54 09/27/03

Go up one level in this thread


On September 27, 2003 at 08:11:24, Omid David Tabibi wrote:

>For a one line code, macros work much faster than inlined functions, e.g.:
>
>#define sgn(x)  (((x) < 0) ? -1 : (((x) > 0) ? 1 : 0))

Do you only find this when you use the ternary operator? IIRC, sometimes the
compiler can turn :? code into a branchless formula, and so that might be the
reason that this code is faster than an inlined function that actually used an
if statement.



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.