mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] bitops: remove unnecessary assignment in fls()
@ 2022-04-26  8:21 menglong8.dong
  0 siblings, 0 replies; only message in thread
From: menglong8.dong @ 2022-04-26  8:21 UTC (permalink / raw)
  To: arnd; +Cc: linux-arch, linux-kernel, Menglong Dong, Mengen Sun

From: Menglong Dong <imagedong@tencent.com>

The last bits left move for the various 'x' in fls() is unnecessary,
and remove it.

Signed-off-by: Mengen Sun <mengensun@tencent.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
 include/asm-generic/bitops/fls.h       | 4 +---
 tools/include/asm-generic/bitops/fls.h | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/include/asm-generic/bitops/fls.h b/include/asm-generic/bitops/fls.h
index b168bb10e1be..07e5cdfc3b98 100644
--- a/include/asm-generic/bitops/fls.h
+++ b/include/asm-generic/bitops/fls.h
@@ -32,10 +32,8 @@ static __always_inline int fls(unsigned int x)
 		x <<= 2;
 		r -= 2;
 	}
-	if (!(x & 0x80000000u)) {
-		x <<= 1;
+	if (!(x & 0x80000000u))
 		r -= 1;
-	}
 	return r;
 }
 
diff --git a/tools/include/asm-generic/bitops/fls.h b/tools/include/asm-generic/bitops/fls.h
index b168bb10e1be..07e5cdfc3b98 100644
--- a/tools/include/asm-generic/bitops/fls.h
+++ b/tools/include/asm-generic/bitops/fls.h
@@ -32,10 +32,8 @@ static __always_inline int fls(unsigned int x)
 		x <<= 2;
 		r -= 2;
 	}
-	if (!(x & 0x80000000u)) {
-		x <<= 1;
+	if (!(x & 0x80000000u))
 		r -= 1;
-	}
 	return r;
 }
 
-- 
2.36.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-26  8:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26  8:21 [PATCH] bitops: remove unnecessary assignment in fls() menglong8.dong

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

all inboxes | Powered by JetHome®