Main Content

Allow right shifts on signed integers

Signed right bitwise shifts in generated code

Description

App Configuration Pane: Code Appearance

Configuration Objects: coder.EmbeddedCodeConfig

Signed right bitwise shifts in generated code.

GPU Coder™ always sets the EnableSignedRightShifts property to true.

Some coding standards, such as MISRA™, do not allow bitwise operations on signed integers. To increase the likelihood of generating MISRA-C:2004 compliant code, set EnableSignedRightShifts to false.

Settings

On

This value is the default value.

The code generator uses signed right shifts. An example of generated C code that uses a signed right shift is:

i >>= 3

Off

The code generator replaces right shifts on signed integers with a function call in the generated code. For example:

i = asr_s32(i, 3U);

Programmatic Use

Property: EnableSignedRightShifts
Values: true | false
Default: true

Version History

Introduced in R2015b