Hans-Christoph Steiner wrote:
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?
I think the proper way is to use a union, so you can refer to the same thing as two different types.
Martin