Main Content
Allow right shifts on signed integers
Allow right bitwise shifts on signed integers
Model Configuration Pane: Code Generation / Code Style
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.
Settings
on
(default) | off
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);
Examples
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | On |
Safety precaution | No impact |
Programmatic Use
Parameter: EnableSignedRightShifts |
Type: character vector |
Value: 'on' | 'off' |
Default: 'on' |
Version History
Introduced in R2015b