From: Keir Fraser Subject: Re: code question? Date: Thu, 11 Aug 2005 17:22:42 +0100 Message-ID: <9aca73363ec8a8b9950b334a4adc799d@cl.cam.ac.uk> References: <1123775716.3043.15.camel@thinkpad> Mime-Version: 1.0 (Apple Message framework v622) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1123775716.3043.15.camel@thinkpad> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jerone Young Cc: xen-devel List-Id: xen-devel@lists.xenproject.org On 11 Aug 2005, at 16:55, Jerone Young wrote: > the part where we have !!current->vcpu_info_evtchen_upcall pending > should this be..should the "!! just be "!"? The code is being a bit defensive, and dealing with the case that evtchn_upcall_pending may be non-zero, but the least significant bit isn't set. That is never actually the case (Xen never sets any other bit than the lsb) so the code could be changed, but not in the way you suggest. The correct change would be simply to remove the !!. > In a lot of the code in Xen we are using the "!" operator with bitwise > operations..this is one of those examples. Forming compound predicates for bitwise operators can be faster than using the logical operators because they are non 'short circuiting'. This means you end up with fewer branches in the generated code and end up with nice straight-line code that should execute fast. -- Keir