Post Go back to editing

Int & Frac Types


I'm using crosscore and an ADSP-21261.

I have some data stored in a frac array and some data stored in an int array.

The data in the int array is actually in frac format - from an external spi.

I'm using an int array as I have to OR bytes together to form the full data - using a frac array the compiler does not allow me to do this, the compiler tells me it must be of int type.

I'd like to get the compiler to treat this int data as frac and add the two arrays together but casting either way does not work.

Is there away of either allowing a frac type to have logic operations performed on it...

frac frResult;

frac frData[3];

frResult = frData[0] | frData[1] | frData[2];

...or is there a way to force the compiler to think int data(with correct frac values stored in it) as frac so in the example below I get 0.25 + 0.25 = 0.5 (or in Frac data 0x20000000 + 0x20000000 = 0x40000000)

frac frData

int iData;

frac frResult;

frData = 0.25;

iData = 0x20000000 // Same as 0.25 in Frac format.

frResult = frData + iData;

Thanks for your help.

Parents Reply Children
No Data