include/linux/bitops.h: Fix function fns
PATCH 1/1 include/linux/bitops.h: Fix function fns
Modified the function fns to resolve a calculation error by:
1. Reducing n first.
2. Adding 1 at the end to get the correct index.
This commit improves the accuracy and reliability of the code.
Signed-off-by Chin-Chun Chen <[email protected]>
--- include/linux/bitops.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/bitops.h +2 -2
@@ -258,8 +258,8 @@ static inline unsigned long fns(unsigned long word, unsigned int n)while (word) { bit =__ffs (word); -if (n-- ==0 ) -return bit; +if (--n ==0 ) +return bit +1 ;__clear_bit (bit, &word); }
base-commit: 8f2c057754b25075aa3da132cd4fd4478cdab854
Signature · 1 line
2.40.1
Quoted 27 lines · Chin-Chun Chen
Modified the function fns to resolve a calculation error by:
1. Reducing n first.
2. Adding 1 at the end to get the correct index.This commit improves the accuracy and reliability of the code.
Signed-off-by Chin-Chun Chen <[email protected]>--- include/linux/bitops.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)include/linux/bitops.h +2
-2@@ -258,8 +258,8 @@ static inline unsigned long fns(unsigned long word, unsigned int n)while (word) { bit =__ffs (word); -if (n-- ==0 ) -return bit; +if (--n ==0 ) +return bit +1 ;__clear_bit (bit, &word); }
Quoted 1 line
base-commit:
8f2c057754b25075aa3da132cd4fd4478cdab854
Hi,
Please send your patch to some maintainer.
People don't browse the mailing list for patches to pick up.
Signature · 3 lines
#Randy https://people.kernel.org/tglx/notes-about-netiquette https://subspace.kernel.org/etiquette.html