Search Linux Wireless

Re: [PATCH 13/13] ath5k: Optimize ath5k_cw_validate

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

 



2011/11/20 Bob Copeland <me@xxxxxxxxxxxxxxx>:
> On Sun, Nov 20, 2011 at 09:56:28AM +0200, Nick Kossifidis wrote:
>> +     /* Check if cw_req + 1 a power of 2 */
>> +     if (!((cw_req + 1) & cw_req))
>> +             return cw_req;
>> +
>> +     /* Check if cw_req is a power of 2 */
>> +     if (!(cw_req & (cw_req - 1)))
>> +             return cw_req - 1;
>
> There's is_power_of_two() in log2.h .. but this whole thing could also
> be something like roundup_pow_of_two(cw) maybe?
>

Nice catch ! I didn't knew about log2.h, seems interesting :-)

roundup_pow_of_two(n) - 1 should take away that while loop but in most
cases we 'll get a correct cw value so is_power_of_two(cw_req + 1)
would take care of that faster.

I'll post an update



-- 
GPG ID: 0xEE878588
As you read this post global entropy rises. Have Fun ;-)
Nick
--
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