Specify whether to replace multiplications by powers of two with signed bitwise shifts. Some coding standards, such as MISRA, do not allow bitwise operations on signed integers. Clearing this option increases the likelihood of generating MISRA C® compliant code.
Category: Code Generation > Code Style
Default: on
Generate code that replaces multiplications by powers of two with signed bitwise shifts.
For example, when you select this option, multiplications by 8 are left-shifted in the generated code:
Y.Out1 = (U.In1 << ((int8_T)3));
Similarly, multiplications by 16 are left-shifted in the generated code:
Y.Out4 = (U.In2 << ((int8_T)4));
Do not allow replacement of multiplications by powers of two with signed shifts. Clearing this option supports MISRA C compliance.
For example, when you clear this option, multiplications by 8 are not replaced by bitwise shifts:
Y.Out1 = U.In1 * ((int64_T)8);
Similarly, multiplications by 16 are not replaced by bitwise shifts:
Y.Out4 = U.In2 * ((int32_T)16);
Parameter: EnableSignedLeftShifts |
Type: character vector |
Value: 'on' | 'off' |
Default: 'on' |
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | On |
Safety precaution | No impact |