lkml.org 
[lkml]   [2014]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] Staging: lustre: Use of fls to find last set bit
On Sun, Jan 12, 2014 at 01:45:51AM +0530, Monam Agarwal wrote:
> This introduces fls in lustre/ldlm/ldlm_extent.c
> to find the last set bit.
>
> Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com>
> ---
> Changes since v1:
> * Incorrect commit message
> * Use of fls function
> Changes since v2:
> * Removal of extra variable
>
> drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
> index ac5d66a..a4f382d 100644
> --- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
> +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
> @@ -153,7 +153,7 @@ static inline int lock_mode_to_index(ldlm_mode_t mode)
>
> LASSERT(mode != 0);
> LASSERT(IS_PO2(mode));
> - for (index = -1; mode; index++, mode >>= 1) ;
> + index = fls(mode)-1;

Put spaces around math operations. Just cut and paste what Joe wrote.

regards,
dan carpenter



\
 
 \ /
  Last update: 2014-01-13 10:01    [W:1.176 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site