lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Fri, 25 Jan 2019 09:02:57 +1300 From: Linus Torvalds <torvalds@...ux-foundation.org> To: Florian La Roche <florian.laroche@...glemail.com> Cc: Linux List Kernel Mailing <linux-kernel@...r.kernel.org>, Crt Mori <cmo@...exis.com>, Joe Perches <joe@...ches.com>, Davidlohr Bueso <dave@...olabs.net>, Will Deacon <will.deacon@....com>, Peter Zijlstra <peterz@...radead.org> Subject: Re: int_sqrt() adjustments On Fri, Jan 25, 2019 at 7:58 AM Florian La Roche <florian.laroche@...glemail.com> 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 that using another type is unnecessary and maybe misleading, when just the default plain regular integer constant works right. So I think this: > - m = 1UL << (__fls(x) & ~1UL); > + m = 1UL << ((fls(x) - 1) & ~1); .. > - m = 1ULL << ((fls64(x) - 1) & ~1ULL); > + m = 1ULL << ((fls64(x) - 1) & ~1); is all good and simplifies the code to not have suffixes that don't really matter or help. Thanks, Linus
Powered by blists - more mailing lists