Is there a way to optimize the Float to Fixed And Fixed to Float conversions in the Talkthrough examples like on can with memcpy?

Or in assembler?

Is there an engineer to engineer note regarding this?

// Unoptimized function to convert the incoming fixed-point data to 32-bit floating-point format.

// This function assumes that the incoming fixed point data is in 1.31 format

void floatData(float *output, int *input, unsigned int instep, unsigned int length)

{

int i;

for(i = 0; i < length; i++)

{

output[i] = __builtin_conv_RtoF(input[instep*i]);

}

}

// Unoptimized function to convert the outgoing floating-point data to 1.31 fixed-point format.

void fixData(int *output, float *input, unsigned int outstep, unsigned int length)

{

int i;

for(i = 0; i < length; i++)

{

output[outstep*i] = __builtin_conv_FtoR(input[i]);

}

}

// Unoptimized function to copy from one floating-point buffer to another

void memcopy(float *input, float *output, unsigned int number)

{

// int i;

// for(i = 0; i < number; i++)

// {

// output[i] = input[i];

// }

memcpy(output, input, sizeof(float) * number);

}

If you're using Update 9, the compiler can do the conversions for you directly, if you're using the native fract types:

#include <stdfix.h>

void fixed_to_float(float *output, const fract *input, int num) {

int i;

for (i = 0; i < num; i++) {

output[i] = input[i];

}

}

(note: that's fract, not unsigned int)

But if you're asking whether there's an optimised function that'll do a block-copy-with-convert, no, there isn't.

steve