public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] riscv: Remove unnecessary int cast in variable_fls()
@ 2024-07-10 20:24 Thorsten Blum
  2024-07-10 21:36 ` Yury Norov
  2024-07-29 16:39 ` patchwork-bot+linux-riscv
  0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2024-07-10 20:24 UTC (permalink / raw)
  To: yury.norov, linux, paul.walmsley, palmer, aou
  Cc: linux-riscv, linux-kernel, Thorsten Blum

__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>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] riscv: Remove unnecessary int cast in variable_fls()
  2024-07-10 20:24 [PATCH] riscv: Remove unnecessary int cast in variable_fls() Thorsten Blum
@ 2024-07-10 21:36 ` Yury Norov
  2024-07-29 16:39 ` patchwork-bot+linux-riscv
  1 sibling, 0 replies; 3+ messages in thread
From: Yury Norov @ 2024-07-10 21:36 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: linux, paul.walmsley, palmer, aou, linux-riscv, linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] riscv: Remove unnecessary int cast in variable_fls()
  2024-07-10 20:24 [PATCH] riscv: Remove unnecessary int cast in variable_fls() Thorsten Blum
  2024-07-10 21:36 ` Yury Norov
@ 2024-07-29 16:39 ` patchwork-bot+linux-riscv
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-07-29 16:39 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: linux-riscv, yury.norov, linux, paul.walmsley, palmer, aou,
	linux-kernel

Hello:

This patch was applied to riscv/linux.git (fixes)
by Yury Norov <yury.norov@gmail.com>:

On Wed, 10 Jul 2024 22:24:18 +0200 you 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>
> ---
>  arch/riscv/include/asm/bitops.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
  - riscv: Remove unnecessary int cast in variable_fls()
    https://git.kernel.org/riscv/c/fb9086e95ad8

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-29 16:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-10 20:24 [PATCH] riscv: Remove unnecessary int cast in variable_fls() Thorsten Blum
2024-07-10 21:36 ` Yury Norov
2024-07-29 16:39 ` patchwork-bot+linux-riscv

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