2017-10-29 21:59 GMT+01:00 Alex Henrie alexhenrie24@gmail.com:
Signed-off-by: Alex Henrie alexhenrie24@gmail.com
Fixes https://bugs.winehq.org/show_bug.cgi?id=43000
lrintf is not part of C89, and we were already using HAVE_LRINTF in msvcrt.
dlls/dsound/dsound_convert.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/dlls/dsound/dsound_convert.c b/dlls/dsound/dsound_convert.c index 6887bae558..ad1aba3737 100644 --- a/dlls/dsound/dsound_convert.c +++ b/dlls/dsound/dsound_convert.c @@ -120,7 +120,11 @@ static inline unsigned char f_to_8(float value) return 0; if(value >= 1.f * 0x7f / 0x80) return 0xFF; +#ifdef HAVE_LRINTF return lrintf((value + 1.f) * 0x80); +#else
- return (value + 1) * 0x80;
+#endif }
The fallback should probably add 0.5f before truncating. Not entirely equivalent but probably closer to the original code.
BTW, we also use lrint() in d3dx9, so we might want to fix it there too. Actually, wouldn't it be better to add generic lrint() / lrintf() fallbacks in libs/port/ instead?