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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sun, 27 Jan 2019 09:31:48 -0800
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>,
        Florian La Roche <Florian.LaRoche@...il.com>
Subject: Re: [PATCH 1/1] int_sqrt() adjustments

On Sun, Jan 27, 2019 at 9:06 AM Florian La Roche
<florian.laroche@...glemail.com> 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
(with the usual int-promotion).

The type of the right side simply doesn't matter (the *value* does, of
course, but because the value range is limited, the cast is just
noise).

                Linus

Powered by blists - more mailing lists