gdb/hppa-tdep.c: Fix a logical typo bug found by compiler warning
Commit Message
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.
If you are sure it is, please help send related patch with more details
comments for it (excuse me, I am not quite familiar the related logical
details).
Thanks.
Comments
> 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.
@@ -1402,8 +1402,8 @@ inst_saves_gr (unsigned long inst)
too. */
if ((inst >> 26) == 0x19 || (inst >> 26) == 0x18
|| ((inst >> 26) == 0x3
- && (((inst >> 6) & 0xf) == 0x8
- || (inst >> 6) & 0xf) == 0x9))
+ && ((inst >> 6) & 0xf) == 0x8
+ || ((inst >> 6) & 0xf) == 0x9))
return hppa_extract_5R_store (inst);
return 0;