Main Content

Shift right on a signed integer as arithmetic shift

How test hardware compiler handles sign bit for right shift on signed integer

Model Configuration Pane: Hardware Implementation


Select this parameter if the C compiler for the test hardware implements a right shift of a signed integer as an arithmetic right shift. An arithmetic right shift fills bits vacated by the right shift with the value of the most significant bit. For signed integers that use twos complement notation, the most significant bit indicates the sign of the number. With this behavior, the arithmetic right shift is the equivalent of dividing the number by two.

Most compilers implement right shifts for signed integers as arithmetic right shifts.

This parameter affects only code generation.

Selecting a device by using the Device vendor and Device type parameters sets a device-specific value for this parameter.


This parameter is enabled only if you can modify it for the selected hardware.


on (default) | off

Generated code for arithmetic shifts on signed integers is simple and efficient.


Generated code for right arithmetic shifts is fully portable but less efficient.

Recommended Settings

DebuggingNo impact
TraceabilityNo impact
Safety precaution

No impact when Test hardware is the same as production hardware is selected. If it is not selected, no recommendation.

Programmatic Use

Parameter: TargetShiftRightIntArith
Type: string | character vector
Values: 'on' | 'off'
Default: 'on'

Version History

Introduced in R2008a