From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: code question? Date: Thu, 11 Aug 2005 11:18:12 -0500 Message-ID: <42FB7A44.8040508@us.ibm.com> References: <1123775716.3043.15.camel@thinkpad> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; 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 Jerone Young wrote: >Doing some janitorial (you cleaning the flooded toilets and such) work >today. I have come across this line of code that really I'm not sure >what the intent was..in xen/include/sched.h > >#define hypercall_preempt_check() (unlikely( \ > softirq_pending(smp_processor_id()) | \ > (!!current->vcpu_info->evtchn_upcall_pending & \ > !current->vcpu_info->evtchn_upcall_mask) \ > )) > >the part where we have !!current->vcpu_info_evtchen_upcall pending >should this be..should the "!! just be "!"? > > The usual use of !!a is to do (a != 0) ? 1 : 0. I'm not sure if there's a more readable way to do it. Regards, Anthony Liguori >And if so shouldn't this just be changed to > >#define hypercall_preempt_check() (unlikely( \ > softirq_pending(smp_processor_id()) | \ > (!(current->vcpu_info->evtchn_upcall_pending & \ > current->vcpu_info->evtchn_upcall_mask)) \ > )) > > >In a lot of the code in Xen we are using the "!" operator with bitwise >operations..this is one of those examples. > > > > >