WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] code question?

To: Jerone Young <jyoung5@xxxxxxxxxx>
Subject: Re: [Xen-devel] code question?
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Thu, 11 Aug 2005 17:22:42 +0100
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 11 Aug 2005 16:16:31 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1123775716.3043.15.camel@thinkpad>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1123775716.3043.15.camel@thinkpad>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>