Contenuto principale

Saturate on integer overflow

Integer overflow support

Description

App Configuration Pane: Speed

Configuration Objects: coder.MexCodeConfig | coder.CodeConfig | coder.EmbeddedCodeConfig

The Saturate on integer overflow parameter specifies whether the code generator produces code to handle integer overflow. By default, overflows saturate to either the minimum or maximum value that the data type can represent. If you disable this parameter, the overflow behavior depends on your target C or C++ compiler. Most C and C++ compilers wrap on overflow.

If you disable this parameter, the generated MEX function might execute more quickly. Do not disable this parameter unless you verify that the range of your input data is within the range that the data type can represent.

This parameter applies only to MATLAB® built-in integer types. It does not apply to double, single, or fixed-point data types.

Settings

On

This setting is the default setting.

The code generator produces code to handle integer overflow. Overflows saturate to either the minimum or maximum value that the data type can represent.

Off

The code generator does not produce code to handle integer overflow. Do not use this option unless you are sure that your code does not depend on integer overflow support.

  • If you disable integer overflow support and run-time error checking is enabled, the generated code produces an error for overflows.

  • If you disable integer overflow support and you disable run-time error checking, the overflow behavior depends on your target compiler. Most C and C++ compilers wrap on overflow.

Programmatic Use

Property: SaturateOnIntegerOverflow
Values: true | false
Default: true

Version History

Introduced in R2011a