Simplify array indexing
Description
Replace multiply operations in array indices when accessing arrays in a loop.
Category: Optimization
Settings
Default: Off
On
In array indices, replace multiply operations with add operations when accessing arrays in a loop in the generated code. When the original signal is multidimensional, the Embedded Coder® generates one-dimensional arrays, resulting in multiply operations in the array indices. Using this setting eliminates costly multiply operations when accessing arrays in a loop in the C/C++ program. This optimization (commonly referred to as strength reduction) is particularly useful if the C/C++ compiler on the target platform does not have similar functionality. The absence of multiply operations in the C/C++ program does not imply that the C/C++ compiler does not generate multiply instructions.
Off
Leave multiply operations in array indices when accessing arrays in a loop.
Dependencies
This parameter:
Requires a Embedded Coder license to generate code.
Appears only for ERT-based targets.
Command-Line Information
Parameter:
StrengthReduction |
Value:
'on' | 'off' |
Default:
'off' |
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | On (execution speed) |
Safety precaution | No impact |