Documentation

Disable Support for Integer Overflow or Non-Finites

The code generator produces supporting code for the following situations:

  • The result of an integer operation falls outside the range that a data type can represent. This situation is known as integer overflow.

  • An operation generates non-finite values (infandNaN). The supporting code is contained in the filesrt_nonfinite.c,rtGetInf.c, andrtGetNaN.c(with corresponding header files).

If you know that these situations do not occur, you can suppress generation of the supporting code. You therefore reduce the size of the generated code and increase its speed. However, if one of these situations occurs, it is possible that the generated code does not match the behavior of the original MATLAB®code.

Disable Support for Integer Overflow

You can use theMATLAB Coder™app or the command-line interface to disable support for integer overflow. When you disable this support, the overflow behavior of your generated code depends on your target C compiler. Most C compilers wrap on overflow.

  • Using the app:

    1. To open theGeneratedialog box, on theGenerate Codepage, click theGeneratearrow.

    2. ClickMore Settings.

    3. On theSpeedtab, clearSaturate on integer overflow.

  • At the command line:

    1. Create a configuration object for code generation. Usecoder.configwith arguments'lib','dll', or'exe'(depending on your requirements). For example:

      cfg = coder.config('lib');

    2. Set theSaturateOnIntegerOverflowproperty tofalse.

      cfg.SaturateOnIntegerOverflow = false;

Disable Support for Non-Finite Numbers

You can use theMATLAB Coderapp or the command-line interface to disable support for non-finite numbers(infandNaN).

  • Using the app:

    1. To open theGeneratedialog box, on theGenerate Codepage, click theGeneratearrow.

    2. SetBuild typeto源代码,Static Library,Dynamic Library, orExecutable(depending on your requirements).

    3. ClickMore Settings.

    4. On theSpeedtab, clear theSupport non-finite numberscheck box.

  • At the command line:

    1. Create a configuration object for code generation. Usecoder.configwith arguments'lib','dll', or'exe'(depending on your requirements). For example:

      cfg = coder.config('lib');

    2. Set the万博1manbetxSupportNonFiniteproperty tofalse.

      cfg.SupportNonFinite = false;

Was this topic helpful?