All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: "Volker Rümelin" <vr_qemu@t-online.de>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, "Riku Voipio" <riku.voipio@iki.fi>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Alexander Bulekov" <alxndr@bu.edu>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Kővágó, Zoltán" <dirty.ice.hu@gmail.com>
Subject: Re: [RFC PATCH 1/2] audio/mixeng: Fix Clang 'int-conversion' warning
Date: Mon, 4 May 2020 08:50:46 +0200	[thread overview]
Message-ID: <d646a579-0317-c062-4672-0fe3229cc56a@amsat.org> (raw)
In-Reply-To: <06aef378-80cf-e24c-d271-58a7670d975d@t-online.de>

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é <f4bug@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
> 
> 


  reply	other threads:[~2020-05-04  6:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-03 11:32 [RFC PATCH 0/2] misc: fix Clang10 warnings Philippe Mathieu-Daudé
2020-05-03 11:32 ` [RFC PATCH 1/2] audio/mixeng: Fix Clang 'int-conversion' warning Philippe Mathieu-Daudé
2020-05-03 12:52   ` BALATON Zoltan
2020-05-03 17:12   ` Richard Henderson
2020-05-04  5:49   ` Volker Rümelin
2020-05-04  6:50     ` Philippe Mathieu-Daudé [this message]
2020-05-03 11:32 ` [RFC PATCH 2/2] linux-user/mmap: Fix Clang 'type-limit-compare' warning Philippe Mathieu-Daudé
2020-05-03 12:49   ` Aleksandar Markovic
2020-05-03 12:55     ` Aleksandar Markovic
2020-05-03 17:18     ` Richard Henderson
2020-05-03 19:04   ` Aleksandar Markovic
2020-06-03 16:06   ` Eric Blake
2020-06-03 18:01     ` Richard Henderson
2020-06-03 18:09       ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d646a579-0317-c062-4672-0fe3229cc56a@amsat.org \
    --to=f4bug@amsat.org \
    --cc=alxndr@bu.edu \
    --cc=dirty.ice.hu@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=vr_qemu@t-online.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.