I'm having the hardest time wraping my brain around Fractional data types.

I need to convert integers, such as the values returned from the ADC,

and floats, such as 0.3835545, to Fract16 values.

In the application note an1772.pdf I found these to be almost useful...

#define _CI(X) *(INT )&(X) /* Convert to int */

#define _CPI(X) (INT *)(X) /* Convert to pointer to int */

#define _CLI(X) *(long int *)&(X) /* Convert to long */

#define _CF(X) *(_fract *)&(X) /* Convert to fractional */

#define _CPF(X) (_fract *)(X) /* Convert to pointer to fract. */

#define _CLF(X) *(long _fract *)&(X) /* Convert to long fract.

except there is no definition of _fract.

Does anyone have working macros to do this?

Thanks for any help

I need to convert integers, such as the values returned from the ADC,

and floats, such as 0.3835545, to Fract16 values.

In the application note an1772.pdf I found these to be almost useful...

#define _CI(X) *(INT )&(X) /* Convert to int */

#define _CPI(X) (INT *)(X) /* Convert to pointer to int */

#define _CLI(X) *(long int *)&(X) /* Convert to long */

#define _CF(X) *(_fract *)&(X) /* Convert to fractional */

#define _CPF(X) (_fract *)(X) /* Convert to pointer to fract. */

#define _CLF(X) *(long _fract *)&(X) /* Convert to long fract.

except there is no definition of _fract.

Does anyone have working macros to do this?

Thanks for any help

This application note describes the process of preparing standard 16-bit, bit-exact algorithms so that they compile for the Freescale DSP56300 family of processors using the DSP56300 C compiler from TASKING, Inc.