All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: colin@cozybit.com, linux-wireless@vger.kernel.org,
	flamingice@sourmilk.net
Subject: Re: [PATCH] Add nl80211 commands to get and set o11s mesh networking parameters.
Date: Sat, 18 Oct 2008 19:00:48 +0200	[thread overview]
Message-ID: <200810181900.48707.mb@bu3sch.de> (raw)
In-Reply-To: <1224341637.6324.29.camel@johannes.berg>

On Saturday 18 October 2008 16:53:57 Johannes Berg wrote:
> > +	return (mask >> (attr-1)) & 0x1;
> 
> I think
> 
> 	return mask & (1<<(attr-1));
> 
> would be easier to understand.


I'm not sure if that would be correct.
The returned type is bool, which is 8bit. mask is 32bit.
So if attr is > 8 you end up with truncation, AFAICS.

So it should be

	return !!(mask & (1<<(attr-1)));

to explicitely convert the mask into a boolean with the LSB
indicating the state.

But the original contruct isn't that bad, either, IMO :)

-- 
Greetings Michael.

  reply	other threads:[~2008-10-18 17:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-17  0:05 [PATCH] Add nl80211 commands to get and set o11s mesh networking parameters colin
2008-10-18 14:53 ` Johannes Berg
2008-10-18 17:00   ` Michael Buesch [this message]
2008-10-18 18:22     ` Johannes Berg
2008-10-20 17:36   ` Colin McCabe

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=200810181900.48707.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=colin@cozybit.com \
    --cc=flamingice@sourmilk.net \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /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.