[PD-dev] freeverb's type-punned pointers
Hans-Christoph Steiner
hans at eds.org
Sat Dec 8 00:22:23 CET 2007
Hey,
I want to fix the type-punned pointer problem in freeverb~ so it can
be compiled with full optimization. Here's the code snippets in
question, with the warnings being issued for the FIX_DENORM_NAN_FLOAT
() lines:
#define IS_DENORM_FLOAT(v) ((((*(unsigned long*)&(v))&0x7f800000)==0)
&&((v)!=0.f))
#define FIX_DENORM_NAN_FLOAT(v) ((v)=IS_DENORM_NAN_FLOAT(v)?0.f:(v))
static inline t_float comb_processR(t_freeverb *x, int filteridx,
t_float input)
{
t_float output;
int bufidx = x->x_combidxR[filteridx];
output = x->x_bufcombR[filteridx][bufidx];
FIX_DENORM_NAN_FLOAT(output);
x->x_filterstoreR[filteridx] = (output*x->x_combdamp2) + (x-
>x_filterstoreR[filteridx]*x->x_combdamp1);
FIX_DENORM_NAN_FLOAT(x->x_filterstoreR[filteridx]);
[snip]
Could I just cast things to (unsigned long)? Or is there a better way?
.hc
------------------------------------------------------------------------
----
http://at.or.at/hans/
More information about the Pd-dev
mailing list