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'm wondering if there is a fast way to convert fixed point to floating poin开发者_运维技巧t, ideally using SSE2. Either straight C or C++ or even asm would be fine.
It's easy as long as you have a double-precision FPU: there are 53 bits of significant figures. SSE2 has double-precision.
float conv_fx( int32_t fx ) {
double fp = fx;
fp = fp / double(1<<16); // multiplication by a constant
return fp;
}
精彩评论