[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH] Remove left shifts of negative signed integer
From: |
Peter Maydell |
Subject: |
Re: [Qemu-trivial] [PATCH] Remove left shifts of negative signed integers |
Date: |
Thu, 30 Jun 2016 21:11:11 +0100 |
On 30 June 2016 at 20:36, John Snow <address@hidden> wrote:
> Another exercise in placating Clang's increasingly strict -Werror mode.
> Technically, this is undefined behavior. In practice, -N<<M is the same
> as -(N<<M).
>
> Signed-off-by: John Snow <address@hidden>
> ---
> hw/audio/fmopl.c | 2 +-
> target-i386/monitor.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
> index 731110f..de9338b 100644
> --- a/hw/audio/fmopl.c
> +++ b/hw/audio/fmopl.c
> @@ -69,7 +69,7 @@ static int opl_dbg_maxchip,opl_dbg_chip;
> /* final output shift , limit minimum and maximum */
> #define OPL_OUTSB (TL_BITS+3-16) /* OPL output final shift
> 16bit */
> #define OPL_MAXOUT (0x7fff<<OPL_OUTSB)
> -#define OPL_MINOUT (-0x8000<<OPL_OUTSB)
> +#define OPL_MINOUT (-(0x8000<<OPL_OUTSB))
We have been down this path before:
http://patchwork.ozlabs.org/patch/545238/
Paolo will doubtless be along with the rant shortly.
-- PMM