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 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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