All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Jerone Young <jyoung5@us.ibm.com>
Cc: xen-devel <xen-devel@lists.xensource.com>
Subject: Re: code question?
Date: Thu, 11 Aug 2005 11:18:12 -0500	[thread overview]
Message-ID: <42FB7A44.8040508@us.ibm.com> (raw)
In-Reply-To: <1123775716.3043.15.camel@thinkpad>

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.
>
>
>
>  
>

  reply	other threads:[~2005-08-11 16:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-11 15:55 code question? Jerone Young
2005-08-11 16:18 ` Anthony Liguori [this message]
2005-08-11 16:22 ` Keir Fraser
2005-08-11 18:14   ` Tim Newsham
2005-08-11 16:55 ` David Hopwood
2005-08-11 17:03 ` M.A. Williamson
2005-08-11 17:23   ` Keir Fraser
2005-08-11 18:53     ` David Hopwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42FB7A44.8040508@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=jyoung5@us.ibm.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.