Re: [PATCH 2/8] KVM: x86: cleanup kvm_apic_match_*()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2015-02-02 15:28+0100, Paolo Bonzini:
> 
> 
> On 02/02/2015 15:26, Radim Krčmář wrote:
> >>> > > +		return ((logical_id >> 4) == (mda >> 4))
> >>> > > +		       && (logical_id & mda & 0xf);
> > was merged as
> > 
> > +		return ((logical_id >> 4) == (mda >> 4))
> > +		       && (logical_id & mda & 0xf) != 0;
> > 
> > but it has to be parenthesized ('&&' has lower precedence than '!=').
> 
> Lower precedence means that the merged version is right (unless my brain
> went bonkers, which I cannot exclude).  "!=" has higher precedence and
> thus it is implicitly parenthesized.
> 
> In fact the first comparison could have its parentheses removed as well.

Yes, it could be,
  logical_id >> 4 == mda >> 4 && (logical_id & mda & 0xf) != 0

I missed the point and thought that you wanted to turn the whole
expression into bool, when it already was one.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux