Documentation Center

  • Trial Software
  • Product Updates

ssFxpConvert

Convert value from one data type to another

Syntax

extern void ssFxpConvert  (SimStruct *S,
                           void *pVoidDest,
                           size_t sizeofDest, 
                           DTypeId dataTypeIdDest, 
                           const void *pVoidSrc, 
                           size_t sizeofSrc, 
                           DTypeId dataTypeIdSrc, 
                           fxpModeRounding roundMode,
                           fxpModeOverflow overflowMode,
                           fxpOverflowLogs *pFxpOverflowLogs)

Arguments

S

SimStruct representing an S-function block.

pVoidDest

Pointer to the converted value.

sizeofDest

Size in memory of the converted value.

dataTypeIdDest

Data type ID of the converted value.

pVoidSrc

Pointer to the value you want to convert.

sizeofSrc

Size in memory of the value you want to convert.

dataTypeIdSrc

Data type ID of the value you want to convert.

roundMode

Rounding mode you want to use if a loss of precision is necessary during the conversion. Possible values are FXP_ROUND_CEIL, FXP_ROUND_CONVERGENT, FXP_ROUND_FLOOR, FXP_ROUND_NEAR, FXP_ROUND_NEAR_ML, FXP_ROUND_SIMPLEST and FXP_ROUND_ZERO.

overflowMode

Overflow mode you want to use if overflow occurs during the conversion. Possible values are FXP_OVERFLOW_SATURATE and FXP_OVERFLOW_WRAP.

pFxpOverflowLogs

Pointer to the fixed-point overflow logging structure.

Description

This function converts a value of any registered built-in or fixed-point data type to any other registered built-in or fixed-point data type.

Requirement

To use this function, you must include fixedpoint.h and fixedpoint.c. For more information, see Structure of the S-Function.

Languages

C

TLC Functions

None

Was this topic helpful?