Add __attribute_const__ and adjust to use (signed) int for the right param of
"<<".
Change the return value of int_sqrt() from "unsigned long" to u32 to be
the same as int_sqrt64() and adjust some calling functions.
Signed-off-by: Florian La Roche
---
Hello Joe,
sending in a new patch with u32 as return value and some adjusted
callers of int_sqrt().
best regards,
Florian La Roche
On Sun, 2019-01-27 at 21:32 +0100, Florian La Roche wrote:
> Add __attribute_const__ and use normal ints for the right param of "<<".
[]
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
[]
> @@ -513,10 +513,10 @@ extern int __kernel_text_address(unsigned long addr);
> extern int
Add __attribute_const__ and use normal ints for the right param of "<<".
Signed-off-by: Florian La Roche
---
include/linux/kernel.h | 4 ++--
lib/int_sqrt.c | 8
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index
On Sun, Jan 27, 2019 at 9:06 AM Florian La Roche
wrote:
>
>
> - m = 1UL << (__fls(x) & ~1UL);
> + m = 1UL << ((int)__fls(x) & ~1);
No need to add the cast. It doesn't do anything and just makes the code uglier.
The type of a shift operator is the type of the left side of the shift
From: Florian La Roche
int_sqrt() and int_sqrt64():
Add __attribute_const__ and adjust to use (signed) int for the right param of
"<<".
Signed-off-by: Florian La Roche
---
include/linux/kernel.h | 4 ++--
lib/int_sqrt.c | 8
2 files changed, 6 insertions(+), 6 deletions(-)
Hello all,
The first part of this patch is wrong: it changes from an unsigned long
param to __fls() to an unsigned int param in fls(). One option would be
to add another implementation of flsl() or given the minimalistic usage
of int_sqrt() in the kernel to keep the current code with __fls() and
On Fri, Jan 25, 2019 at 7:58 AM Florian La Roche
wrote:
>
> __fls() is returning an unsigned long, but fls() and fls64() are
> both returning a (signed) int.
> As we need a signed int as right operand of "<<" (as Linus pointed out),
It's not that the "signed" part is all that important, it's
__fls() is returning an unsigned long, but fls() and fls64() are
both returning a (signed) int.
As we need a signed int as right operand of "<<" (as Linus pointed out),
change __fls() to fls() for 32bit and also adjust masking the lowest bit
to be a signed int.
Now the 32bit and the 64bit
__fls() is returning an unsigned long, but fls() and fls64() are
both returning a (signed) int.
As we need a signed int as right operand of "<<" (as Linus pointed out),
change __fls() to fls() for 32bit and also adjust masking the lowest bit
to be a signed int.
Now the 32bit and the 64bit
10 matches
Mail list logo