Hello all,
I am using MATLAB 2018b and I have run into a problem with Safe Cast Function in Generated Code.
In my Simulink model I have a Stateflow state machine that uses Simulink Functions whose input data type is a Simulink.defineIntEnumType. So whenever the Simulink Functions are called, their inputs are preprocessed by a Safe Cast function like the following below:
static uint8 <Simulink_model_name>_safe_cast_to_<Enum_type>(uint8 input)
Due to the amount of Simulink Function calls, the generated code becomes pretty much inefficient.
Looking into Embedder Coder user guide and MATLAB help, it is suggested to disable the block parameter: Saturate on integer overflow in order to prevent these safe cast functions from being included in the generated code.
However, the problem is that although I have disabled this parameter in the block which contains the Simulink Function calls, the safe cast functions are still generated in the resulting code.
Is there any other related parameter that I need to configure or any other Enum-related default settings that can be overridden to avoid safe cast functions?
Thank you very much for your support, any feedback would be greatly appreciated.