[PD-dev] t_sample vs t_float in PDa vs vanilla

IOhannes m zmölnig zmoelnig at iem.at
Fri Jan 1 21:21:24 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hans-Christoph Steiner wrote:
> 
> 
> Here's the code in question, from PDa:

ah which reminds me of the thing i forgot in my last email: please add
line numbers when you refer to a sepcific line in a file.
<snip>
d_arithhmetic.c:
   t_float g = *(t_float *)(w[2]);
</snip>
is a bit vague for my taste (ever tried to grep for "int i" :-))



> So based on your comments, it would go something like this, which seems
> needlessly verbose and wasteful of CPU cycles:
[...]
>         out[0] = f0 + ftofix(g); out[1] = f1 + ftofix(g); out[2] = f2 +
> ftofix(g); out[3] = f3 + ftofix(g);

i guess you are not trying to be nasty on purpose :-)
i can't see how your interpretation makes the code more readable.


i was trying to say something along:
<code>

t_int *scalarplus_perf8(t_int *w)
{
    t_sample *in = (t_sample *)(w[1]);
    t_float g_f = *(t_float *)(w[2]);
    t_sample g = ftofix(g_f);
[...]
        out[0] = f0+g; out[1] = f1+g; out[2] = f2+g; out[3] = f3+g;
</code>

this would take as much cycles as
t_sample g = ftofix(*(t_float *)(w[2]));
but separate the code for getting the value and making it a sample.

fgasdmr
IOhannes


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAks+WUQACgkQkX2Xpv6ydvQWPACgymwWzv4hAPJ+Y10QXSsLl9+3
HowAoMnCzbBi/kAyZ+LEzhf2khzxHerc
=gy6T
-----END PGP SIGNATURE-----




More information about the Pd-dev mailing list