Search Linux Wireless

Re: [PATCH] Add nl80211 commands to get and set o11s mesh networking parameters.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2008-10-18 at 19:00 +0200, Michael Buesch wrote:
> 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)));

Indeed.

> to explicitely convert the mask into a boolean with the LSB
> indicating the state.
> 
> But the original contruct isn't that bad, either, IMO :)

True :) I just had to think about it for a moment, but that's ok :)

johannes

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux