winmm: Fix conversion to MMTIME, avoid floating point arithmetic.

Joerg-Cyril.Hoehle at t-systems.com Joerg-Cyril.Hoehle at t-systems.com
Thu Jan 5 03:24:51 CST 2012


Hi,

both the old alsa.c and waveform.c convert incorrectly, mainly because smpte.sec is a small BYTE entity.

I've preserved without further testing alsa.c's original rounding mode.
Note that winmm/tests/wave and winmm/waveform round differently, but it's enough for the performed tests.

Regarding the a * b / c pattern, every time I encountered it (in mciwave and mmdevapi),
MulDiv was the rounding function that produced results like native. Possibly MulDiv is used in many more such
places. Perhaps MS used MulDiv extensively because that was THE function that dealt well with
large UINT32 back when UINT64 was unavailable, i.e. (UINT64)a * b / c not useable.

All places that use (double) for higher resolution than UINT32 ought to be rewritten.

Regards,
 Jörg Höhle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-winmm-Fix-conversion-to-MMTIME-avoid-floating-poin.patch
Type: application/octet-stream
Size: 3218 bytes
Desc: 0001-winmm-Fix-conversion-to-MMTIME-avoid-floating-poin.patch
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20120105/4e9deb01/attachment.obj>


More information about the wine-patches mailing list