With this method, I got the compiler warning about breaking the strict aliasing rule:
uint8_t bytes[4] = {12, 34, 56, 78};
float f = *(float*)bytes;
This is my code, and for now, it is working properly. But I am not sure if this is an efficient way or not.
typedef struct _xsensparse
{
t_object x_obj;
uint8_t wrd[4];
t_float o;
t_outlet *f1_out, *f2_out;
} t_xsensparse;
static void xsensparse_list(t_xsensparse *x, t_symbol *s, int argc, t_atom *argv)
{
for(int i=0; i<argc; i++) {
x->wrd[i]=(uint8_t)atom_getfloat(argv+3-i);
memcpy(&x->o, &x->wrd, 4);
}
post("%f", x->o);
outlet_float(x->f1_out, x->o);
}