On Jan 1, 2010, at 3:21 PM, IOhannes m zmölnig wrote:
-----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.
This would obviously work better that my code, but I still don't see
the point of using a t_float there. All three lines are casting
t_ints from w into values that then get added together to be a
t_sample so why use anything the middle? On PDa that means casting a
t_int to a t_float then to an int (i.e. t_sample) for no reason.
.hc
----------------------------------------------------------------------------
Mistrust authority - promote decentralization. - the hacker ethic
_______________________________________________
Pd-dev mailing list
[email protected]
http://lists.puredata.info/listinfo/pd-dev