The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: Chin-Chun Chen <chinchunchen2001@gmail.com>
Cc: linux@rasmusvillemoes.dk, linux-kernel@vger.kernel.org,
	Chin-Chun Chen <chinchunchen2001@gmail.com>
Subject: Re: [PATCH v2] include/linux/bitops.h: Fix function fns
Date: Sat, 13 Apr 2024 10:14:10 -0700	[thread overview]
Message-ID: <Zhq9YpzCbvom3GFx@yury-ThinkPad> (raw)
In-Reply-To: <20240413155635.11486-1-chinchunchen2001@gmail.com>

On Sat, Apr 13, 2024 at 11:56:35PM +0800, Chin-Chun Chen wrote:
> Modified the function fns to resolve a calculation error by reducing n first to correctly determine the n-th set bit instead of n+1.
> 
> This commit improves the accuracy and reliability of the code.

No it doesn't. Accuracy and reliability is tested in lib/test_bitmap.c.
Have you tried to run it before sending this patch?

What error did you mean? How does pre-decrement over post-increment fix it?

> ---
> Changes since v1:
> * Clarified the commit message.
> * Fixed the incorrect operation.
> 
> Signed-off-by: Chin-Chun Chen <chinchunchen2001@gmail.com>
> ---
>  include/linux/bitops.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/bitops.h b/include/linux/bitops.h
> index 2ba557e067fe..5842d7d03f19 100644
> --- a/include/linux/bitops.h
> +++ b/include/linux/bitops.h
> @@ -258,7 +258,7 @@ static inline unsigned long fns(unsigned long word, unsigned int n)
>  
>  	while (word) {
>  		bit = __ffs(word);
> -		if (n-- == 0)
> +		if (--n == 0)
>  			return bit;
>  		__clear_bit(bit, &word);
>  	}
> 
> base-commit: 8f2c057754b25075aa3da132cd4fd4478cdab854

What does this 'base-commit' mean?

Chin-Chun, if it's your first attempt to contribute to a public
project, you're very welcome. But you have to be more descriptive
on the error you're facing and trying to fix. The best practice is
to provide a test together with a fix.

Thanks,
Yury

--

It may be just my paranoia after UMN and xz stories, but... I
googled for this person and the email and found that it didn't
appear in public domain before now. Let's see...

      parent reply	other threads:[~2024-04-13 17:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-13  6:12 [PATCH] include/linux/bitops.h: Fix function fns Chin-Chun Chen
2024-04-13 16:15 ` [PATCH v2] " Chin-Chun Chen
     [not found] ` <20240413155635.11486-1-chinchunchen2001@gmail.com>
2024-04-13 17:14   ` Yury Norov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zhq9YpzCbvom3GFx@yury-ThinkPad \
    --to=yury.norov@gmail.com \
    --cc=chinchunchen2001@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox