lkml.org 
[lkml]   [2019]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/1] int_sqrt() adjustments
On Sun, Jan 27, 2019 at 9:06 AM Florian La Roche
<florian.laroche@googlemail.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

\
 
 \ /
  Last update: 2019-01-27 18:32    [W:0.257 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site