Fastest way to convert 16.16 fixed point to 32-bit float in c / C ++ on x86?

Most people seem to want to go the other way. I am wondering if there is a quick way to convert a fixed point to a floating point, ideally using SSE2. Either direct C, or C ++, or even asm will be fine.

+3
source share
1 answer

This is easy if you have dual precision FPUs: there are 53 bits of significant digits. SSE2 has double precision.

float conv_fx( int32_t fx ) {
    double fp = fx;
    fp = fp / double(1<<16); // multiplication by a constant
    return fp;
}
+2
source

Source: https://habr.com/ru/post/1732119/


All Articles