public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Nikanth Karthikesan <knikanth@novell.com>
Cc: nikanth@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: Strange code in include/linux/cpumask.h
Date: Wed, 25 Mar 2009 15:41:11 +1030	[thread overview]
Message-ID: <200903251541.12180.rusty@rustcorp.com.au> (raw)
In-Reply-To: <200903251021.13811.knikanth@novell.com>

On Wednesday 25 March 2009 15:21:13 Nikanth Karthikesan wrote:
> Hi Rusty
> 
> I do not understand this code.

Hi Nikanth,

   That's OK, it's a little tricky.

> The conditional operator would always evaluates to true and return bitmap. So 
> all it seems to does is
> #define to_cpumansk(bitmap) (struct cpumask *)(bitmap)

Yes, except that this insists that bitmap be an unsigned long * or you'll get
a warning.  Otherwise the macro could be used on anything.  And it needs to be
a macro to use it as a static initializer.

As the NR_CPUS bit arrays vanish, this macro will be used less and less; but
some of them will probably take a while.

Thanks for the question,
Rusty.

  reply	other threads:[~2009-03-25  5:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-25  4:51 Strange code in include/linux/cpumask.h Nikanth Karthikesan
2009-03-25  5:11 ` Rusty Russell [this message]
2009-03-25  6:44   ` Nikanth Karthikesan
2009-03-25 22:44     ` Rusty Russell
2009-03-26  4:12       ` Nikanth Karthikesan

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=200903251541.12180.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=knikanth@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nikanth@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox