Allow right shifts on signed integers

Description

Specify whether to allow signed right bitwise shifts in the generated C/C++ code. Some coding standards, such as MISRA, do not allow bitwise operations on signed integers. Clearing this option increases the likelihood of generating MISRA-C:2004 compliant code.

Category: Code Generation > Code Style

Settings

Default: on

On

Generate code that uses right bitwise shifts on signed integers.

For example, when you select this option, right shifts appear in the generated code.

i >>= 3

Off

Do not allow right shifts on signed integers. Clearing this option supports MISRA C® compliance.

For example, when you clear this option, right shifts are replaced with a function call.

i = asr_s32(i, 3U);

Command-Line Information

Parameter: EnableSignedRightShifts
Type: character vector
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyOn
Safety precautionNo impact

Related Topics