[PATCH 1/4] dsound: Change mix_buffer to float instead of INT
Alexander E. Patrakov
patrakov at gmail.com
Tue May 15 01:46:51 CDT 2012
Andrew Eikum wrote:
> +static LONG f_to_24(float value)
> +{
> if(value <= -1.f)
> + return 0x80000000;
> + if(value >= 1.f * 0x7FFFFF / 0x800000)
> + return 0x7FFFFF00;
> + return lrintf(value * 0x80000000U);
> }
...
> +static inline LONG f_to_32(float value)
> +{
> + if(value <= -1.f)
> + return 0x80000000;
> + if(value >= 1.f * 0x7FFFFFFF / 0x80000000U) /* this rounds to 1.f */
> + return 0x7FFFFFFF;
> + return le32(lrintf(value * 0x80000000U));
> +}
[sorry for a possible duplicate, the previous mail contained a typo]
Minor nitpick: I'd say these functions are identical on little-endian
systems if the least significant bits are discarded. Are you sure that
we indeed want two functions here, and not, say, use f_to_32() in
put24()?
--
Alexander E. Patrakov
More information about the wine-devel
mailing list