drat. even my code comments note that its float<->short that sucks on
intel. but steve comes to the rescue, as normal:

>inline int f_round(float f) {
>        f += (3<<22);
>        return *((int*)&f) - 0x4b400000;
>}
>
>output = f_round(32768.0f * input)
>
>You still need to clamp output to [SHRT_MIN,SHRT_MAX], otherwise you might
>get overflow.

if you have to clamp, is it worth it? if input is -1..1.0, how the
output ever overflow?

--p

Reply via email to