The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH V2 mmots] fs/hfsplus/wrapper.c: replace shift loop by fls
@ 2014-05-16 20:38 Fabian Frederick
  2014-05-19 23:09 ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Fabian Frederick @ 2014-05-16 20:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, Joe Perches

Replace while blocksize;shift by fls -1

Suggested-By: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Fabian Frederick <fabf@skynet.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);
 
 	/*
-- 
1.8.4.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-05-20  5:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-16 20:38 [PATCH V2 mmots] fs/hfsplus/wrapper.c: replace shift loop by fls Fabian Frederick
2014-05-19 23:09 ` Andrew Morton
2014-05-19 23:22   ` Joe Perches
2014-05-19 23:40     ` Andrew Morton
2014-05-19 23:50       ` Joe Perches
2014-05-20  5:02         ` Fabian Frederick
2014-05-20  5:10           ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox