I would like to optimize my C ++ code for an ARM device that does not have a floating point block. Most of my functions use float, and I'm considering changing them to a fixed point.
Are there any real benefits with ARM devices, or are the compilers smart enough to do it themselves?
For example, whether it will be more efficient on an ARM device.
unsigned int a, b;
a= *input++ << 12;
b= *input++ << 12;
a*=1024; //0.25 shifted 12 bits
b*=1024; //0.25 shifted 12 bits
*output++ = (a+b) >> 24;
than
float a,b;
a= *input++;
b= *input++;
a=a/4;
b=a/4;
*output++ = a+b;
source
share