From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754101AbbBBObG (ORCPT ); Mon, 2 Feb 2015 09:31:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40046 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752833AbbBBObD (ORCPT ); Mon, 2 Feb 2015 09:31:03 -0500 Date: Mon, 2 Feb 2015 15:30:54 +0100 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Nadav Amit , Gleb Natapov Subject: Re: [PATCH 2/8] KVM: x86: cleanup kvm_apic_match_*() Message-ID: <20150202143054.GC19731@potion.redhat.com> References: <1422568135-28402-1-git-send-email-rkrcmar@redhat.com> <1422568135-28402-3-git-send-email-rkrcmar@redhat.com> <54CB4668.30909@redhat.com> <20150202142633.GA19731@potion.redhat.com> <54CF8993.7060901@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <54CF8993.7060901@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.