[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] Re: Changes checked into CVS

From: Paul Millar
Subject: Re: [fluid-dev] Re: Changes checked into CVS
Date: Mon, 11 Dec 2006 14:58:50 +0000
User-agent: KMail/1.9.5

On Monday 11 December 2006 14:24, Josh Green wrote:
> On Mon, 2006-12-11 at 00:19 +0200, Mihail Zenkov wrote:
> > IMHO better replace roundf with this code in all case:
> >
> > inline int roundi(float x)
> > It slightly faster then gcc roundf (1.5 time).
> Sounds good, will also be more portable :)  I suppose a macro such as
> this would also do the trick?
> #define roundi(x)   ((x >= 0.0f) ? (int)(x+0.5f) : (int)(x-0.5f))

You'd need parentheses around the x characters in the expansion.  Even then, 
its slightly dangerous:

y = roundi( sin(x));

results in two evaluations of sin(x).  The quintessential bad one is:

y = roundi( x++);




Attachment: pgpQmVnprvYc4.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]