frac32 in
frac32 out
combo resolution
// __CLZ counts leading zeros
int32_t offset = 32 - __CLZ(abs(inlet_in)) - attr_resolution;
if (offset <= 0) {
outlet_out = inlet_in;
} else {
// erases some low bits depending of leading zeros and resolution
outlet_out = (inlet_in >> offset) << offset;
}
/*
union Y { float f; int32_t i; } y;
y.f = arm::q_to_float(inlet_in, 27);
#if attr_resolution == 5
y.i &= 0xFFFF8000;
#elif attr_resolution == 6
y.i &= 0xFFFFC000;
#elif attr_resolution == 7
y.i &= 0xFFFFE000;
#elif attr_resolution == 8
y.i &= 0xFFFFF000;
#elif attr_resolution == 3
y.i &= 0xFFFE0000;
#else
y.i &= 0xFFFF0000;
#endif
outlet_out=arm::float_to_q(y.f, 27);
*/