public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: Thorsten Blum <thorsten.blum@toblux.com>
Cc: linux@rasmusvillemoes.dk, paul.walmsley@sifive.com,
	palmer@dabbelt.com, aou@eecs.berkeley.edu,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] riscv: Remove unnecessary int cast in variable_fls()
Date: Wed, 10 Jul 2024 14:36:04 -0700	[thread overview]
Message-ID: <Zo7-xDMFXVpIqyuR@yury-ThinkPad> (raw)
In-Reply-To: <20240710202416.710880-3-thorsten.blum@toblux.com>

On Wed, Jul 10, 2024 at 10:24:18PM +0200, Thorsten Blum wrote:
> __builtin_clz() returns an int and casting the whole expression to int
> is unnecessary. Remove it.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>

Added in bitmap-for-next for testing.

Thanks,
Yury

> ---
>  arch/riscv/include/asm/bitops.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/include/asm/bitops.h b/arch/riscv/include/asm/bitops.h
> index 880606b0469a..71af9ecfcfcb 100644
> --- a/arch/riscv/include/asm/bitops.h
> +++ b/arch/riscv/include/asm/bitops.h
> @@ -170,7 +170,7 @@ static __always_inline int variable_fls(unsigned int x)
>  ({								\
>  	typeof(x) x_ = (x);					\
>  	__builtin_constant_p(x_) ?				\
> -	 (int)((x_ != 0) ? (32 - __builtin_clz(x_)) : 0)	\
> +	 ((x_ != 0) ? (32 - __builtin_clz(x_)) : 0)		\
>  	 :							\
>  	 variable_fls(x_);					\
>  })
> -- 
> 2.45.2

  reply	other threads:[~2024-07-10 21:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-10 20:24 [PATCH] riscv: Remove unnecessary int cast in variable_fls() Thorsten Blum
2024-07-10 21:36 ` Yury Norov [this message]
2024-07-29 16:39 ` patchwork-bot+linux-riscv

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=Zo7-xDMFXVpIqyuR@yury-ThinkPad \
    --to=yury.norov@gmail.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=thorsten.blum@toblux.com \
    /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