From: "Volker Rümelin" <vr_qemu@t-online.de>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Riku Voipio <riku.voipio@iki.fi>,
Laurent Vivier <laurent@vivier.eu>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [RFC PATCH 1/2] audio/mixeng: Fix Clang 'int-conversion' warning
Date: Mon, 4 May 2020 07:49:01 +0200 [thread overview]
Message-ID: <06aef378-80cf-e24c-d271-58a7670d975d@t-online.de> (raw)
In-Reply-To: <20200503113220.30808-2-f4bug@amsat.org>
> 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
With best regards,
Volker
next prev parent reply other threads:[~2020-05-04 5:49 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 [this message]
2020-05-04 6:50 ` Philippe Mathieu-Daudé
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=06aef378-80cf-e24c-d271-58a7670d975d@t-online.de \
--to=vr_qemu@t-online.de \
--cc=f4bug@amsat.org \
--cc=kraxel@redhat.com \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=riku.voipio@iki.fi \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).