[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] Remove left shifts of negative signed integers
From: |
John Snow |
Subject: |
Re: [Qemu-devel] [PATCH] Remove left shifts of negative signed integers |
Date: |
Thu, 30 Jun 2016 16:13:47 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 |
On 06/30/2016 04:11 PM, Peter Maydell wrote:
> 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
>
I figured, so I CC'd him. Nobody can say I didn't try.
--js