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

Re: [Sc-devel] float->int casts in OscUGens.cpp (and elsewhere?)



Hi -

I don't remember this ever having come up in discussion. Thanks for
pointing it out.

I personally wouldn't know what to do along the assembly route, others
here probably would; but do you have any hints re the C99? (Not sure
if you're thinking about specific functions, or specific ways to write
the expression for the compiler to optimise, etc.) If we can try
rejigging the C, the improvement could be very straightforward.

Dan


2008/1/9, Ross Bencina <rossb-lists@xxxxxxxxxxxxxx>:
> Hi Guys
>
>
>
> I notice that OscUGens.cpp contains a number of direct downcasts from double
> to int32, such as line 1840:
>
>
>
> phase += (int32)(cpstoinc * ZXP(freqin));
>
>
>
> I assume it's been discussed here before, but this is a particularly
> inefficient thing to do on IA32 processors. Luckily this assignment isn't
> too sensitive to which way the rounding goes, so there are some simple
> assembly solutions (such as using fistp to store the intermediate value into
> an integer location). I think there are even some standard C99 functions...
>
>
>
> Is anyone in a position to take care of this?
>
>
>
> Cheers
>
> Ross.
> _______________________________________________
> Sc-devel mailing list
> Sc-devel@xxxxxxxxxxxxxxx
> http://lists.create.ucsb.edu/mailman/listinfo/sc-devel
>


-- 
http://www.mcld.co.uk