[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH 1/2] audio/mixeng: Fix Clang 'int-conversion' warning

From: Philippe Mathieu-Daudé
Subject: Re: [RFC PATCH 1/2] audio/mixeng: Fix Clang 'int-conversion' warning
Date: Mon, 4 May 2020 08:50:46 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

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é <address@hidden>
  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)
-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)

Please don't forget to fix the RECIPROCAL case.

Btw. the problem was reported here:

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,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]