Skip to contentSkip to conversation

bitops: remove unnecessary assignment in fls()

PATCH New [email protected] 1 participant 1 message Apr 26, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitops: remove unnecessary assignment in fls()

From: Menglong Dong <[email protected]>

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

---
 include/asm-generic/bitops/fls.h       | 4 +---
 tools/include/asm-generic/bitops/fls.h | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
include/asm-generic/bitops/fls.h +1 -3
index b168bb10e1be..07e5cdfc3b98 100644
@@ -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;
 }
 
tools/include/asm-generic/bitops/fls.h +1 -3
index b168bb10e1be..07e5cdfc3b98 100644
@@ -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;
 }
 
Signature · 1 line
2.36.0