diff options
author | Xenia Ragiadakou <burzalodowa@gmail.com> | 2013-06-15 07:29:01 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-17 15:45:43 -0700 |
commit | 391c72a30bba9d569d5762a2f18d0dd4f3bdc5ba (patch) | |
tree | 2dd62061b534dbf4d63e26bb38da3d926328e998 /drivers/staging/rtl8192u | |
parent | 409359a12d29c53378c3a61db6188e3e2435f874 (diff) |
staging: rtl8192u: fix bitshift calculation in r819xU_phy.c
This patch uses the ffs linux built-in routine in the
computation of the bitshift to take advantage of
architecture specific instructions that implement this
computation more efficiently.
Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8192u')
-rw-r--r-- | drivers/staging/rtl8192u/r819xU_phy.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index d66d88cc189e..70ab9cd0b29f 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -7,6 +7,8 @@ #include "r819xU_firmware_img.h" #include "dot11d.h" +#include <linux/bitops.h> + static u32 RF_CHANNEL_TABLE_ZEBRA[] = { 0, 0x085c, //2412 1 @@ -45,11 +47,7 @@ static u32 RF_CHANNEL_TABLE_ZEBRA[] = { u32 rtl8192_CalculateBitShift(u32 dwBitMask) { u32 i; - for (i=0; i<=31; i++) - { - if (((dwBitMask>>i)&0x1) == 1) - break; - } + i = ffs(dwBitMask) - 1; return i; } /****************************************************************************** |