I noticed that when multiplying a signal by a power of 2 (via a Gain block), the generated code shows:
(val << 14) >> 12
instead of:
val << 2
To reproduce the issue, generate code for model, mux_to_array.mdl, found in the attachments. The generated code has the following line:
mux_to_array_Y.Out1 = (int16_T)((((mux_to_array_U.In1 << 2U) << 14) >> 13) * 3);
Best Answer