lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140519160946.84e79c832dfc4db0fbae573b@linux-foundation.org>
Date:	Mon, 19 May 2014 16:09:46 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Fabian Frederick <fabf@...net.be>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>,
	Joe Perches <joe@...ches.com>
Subject: Re: [PATCH V2 mmots] fs/hfsplus/wrapper.c: replace shift loop by
 fls

On Fri, 16 May 2014 22:38:15 +0200 Fabian Frederick <fabf@...net.be> wrote:

> Replace while blocksize;shift by fls -1
> 
> Suggested-By: Joe Perches <joe@...ches.com>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Signed-off-by: Fabian Frederick <fabf@...net.be>
> ---
> v2: rebased on top of mmots
>     compiles without including bitops
> 
>  fs/hfsplus/wrapper.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c
> index 284c90f..8e8cf50d 100644
> --- a/fs/hfsplus/wrapper.c
> +++ b/fs/hfsplus/wrapper.c
> @@ -231,9 +231,7 @@ reread:
>  	if (blocksize < HFSPLUS_SECTOR_SIZE || ((blocksize - 1) & blocksize))
>  		goto out_free_backup_vhdr;
>  	sbi->alloc_blksz = blocksize;
> -	sbi->alloc_blksz_shift = 0;
> -	while ((blocksize >>= 1) != 0)
> -		sbi->alloc_blksz_shift++;
> +	sbi->alloc_blksz_shift = fls(blocksize) - 1;
>  	blocksize = min_t(u32, sbi->alloc_blksz, PAGE_SIZE);

fls() always makes my brain hurt.  ilog() is nicer?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ