Shift right on a signed integer as arithmetic shift
How the test hardware compiler handles sign bit for right shift on signed integer
Model Configuration Pane: Hardware Implementation
Description
The Shift right on a signed integer as arithmetic shift parameter specifies whether 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 two's-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.
The 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.
Dependencies
This parameter is enabled only if you can modify it for the selected hardware.
Settings
on
(default) | off
on
Generated code for arithmetic shifts on signed integers is simple and efficient.
off
Generated code for right arithmetic shifts is fully portable but less efficient.
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | On |
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
See Also
Topics
- Specifying Test Hardware Characteristics (Simulink Coder)
- Hardware Implementation Options (Simulink Coder)
- Hardware Implementation Pane