This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb/hppa-tdep.c: Fix a logical typo bug found by compiler warning
- From: Chen Gang <gang dot chen dot 5i5j at gmail dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: Andreas Schwab <schwab at linux-m68k dot org>, gdb-patches at sourceware dot org
- Date: Thu, 16 Oct 2014 08:30:49 +0800
- Subject: Re: [PATCH] gdb/hppa-tdep.c: Fix a logical typo bug found by compiler warning
- Authentication-results: sourceware.org; auth=none
OK, thanks, I shall send patch v2 for it, and sorry for my original careless reading.
Send from Lenovo A788t.
Joel Brobecker <brobecker@adacore.com> wrote:
>> On 10/15/2014 05:29 AM, Andreas Schwab wrote:
>> > Chen Gang <gang.chen.5i5j@gmail.com> writes:
>> >
>> >> && (((inst >> 6) & 0xf) == 0x8
>> >> - || (inst >> 6) & 0xf) == 0x9))
>> >> + || ((inst >> 6) & 0xf) == 0x9)))
>> >
>> > ((inst >> 6) & 0xe) == 8
>> >
>> > Andreas.
>> >
>>
>> I guess, your fixing may like below, which will be a different logical
>> working flow.
>
>I think Andreas is telling you that...
>
> ((inst >> 6) & 0xf) == 0x8
> || ((inst >> 6) & 0xf) == 0x9
>
>... is logically equivalent to ...
>
> ((inst >> 6) & 0xe) == 8
>
>In other word, if it does not matter if bit 7 is set or not
>(the difference between 0x8 and 0x9) all you have to do is mask it.
>That way, you test both conditions with one comparison instead of 2.
>
>--
>Joel