Main Content

Defensive Programming

Make tradeoffs between defensive and efficient code

Improve the efficiency of the generated code by removing code that performs subnormal number calculations or guards against a possible mismatch between simulation and code generation results.

Topics

Remove Code From Floating-Point to Integer Conversions That Wraps Out-of-Range Values

If the input values in your application are in the range of the output type, remove code for out-of-range floating-point to integer conversions.

Remove Code That Maps NaN to Integer Zero

If input values of NaN do not exist in your application, specify that the code generator remove code that maps NaN to integer zero.

Disable Nonfinite Checks or Inlining for Math Functions

Use code replacement library (CRL) customization entries to selectively disable nonfinite checks for math functions and inlining of math functions.

Subnormal Number Execution Speed

Minimize the possibility of execution slowdowns or overruns due to subnormal number calculation latency.

Remove Code That Guards Against Division Exceptions for Integers and Fixed-Point Data

Optimize the generated code by removing code that protects against division by zero and overflows in division INT_MIN/-1 operations for integers and fixed-point data.

Remove Code from Tunable Parameter Expressions That Saturate Against Integer Overflow

Remove code that prevents integer overflow of tunable expression parameters for efficiency benefits.