On 5/4/20 7:49 AM, Volker Rümelin wrote:
Fix by using a 64-bit float for the conversion, before casting
back to 32-bit float.
Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
---
audio/mixeng.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/audio/mixeng.c b/audio/mixeng.c
index 739a500449..9946bfeaec 100644
--- a/audio/mixeng.c
+++ b/audio/mixeng.c
@@ -271,7 +271,7 @@ f_sample *mixeng_clip[2][2][2][3] = {
#define CONV_NATURAL_FLOAT(x) (x)
#define CLIP_NATURAL_FLOAT(x) (x)
#else
-static const float float_scale = UINT_MAX / 2.f;
+static const float float_scale = UINT_MAX / 2.;
I would prefer an explicit cast of UINT_MAX to float. This is what we already
have in audio/mixeng_template.h in the conf_* and clip_* functions with
FLOAT_MIXENG defined. I think similar functions should look similar.
#define CONV_NATURAL_FLOAT(x) ((x) * float_scale)
#ifdef RECIPROCAL
Please don't forget to fix the RECIPROCAL case.
Btw. the problem was reported here:
https://lists.nongnu.org/archive/html/qemu-devel/2020-03/msg02270.html
Ah I missed that, I now feel safer knowing developers who understand
this code are already trying to fix it, thanks Volker!
With best regards,
Volker