Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/sys



On Thu, Mar 08, 2018 at 10:25:45PM +0000, Christos Zoulas wrote:
> In article <20180308215453.GB22758%britannica.bec.de@localhost>,
> Joerg Sonnenberger  <joerg%bec.de@localhost> wrote:
> >On Thu, Mar 08, 2018 at 03:32:33PM -0500, Christos Zoulas wrote:
> >> Module Name:	src
> >> Committed By:	christos
> >> Date:		Thu Mar  8 20:32:33 UTC 2018
> >> 
> >> Modified Files:
> >> 	src/sys/sys: bitops.h
> >> 
> >> Log Message:
> >> PR/53081: Fix size of the shift to depend on the type of the bitmap so that
> >> we get the correct width.
> >
> >Please don't use __typeof__. 1ull is good enough and we can depend on
> >a non-stupid compiler to truncate the intermediate.
> 
> The __typeof__ ship has already sailed:
> 
> $ fgrep -r __typeof__ /usr/include/sys/ | wc -l
>        3

Of those, only the rounddown2 is non-optional. That falls into the same
category even, it doesn't really hurt to widen there.

> Doing a 64 bit calculation on a 32 bit platform when it is not needed
> is a waste (and produces narrowing warnings).

It's not a 64bit calculation if the compiler is at least trying to
create sane code. The bit masking should ensure that.

Joerg


Home | Main Index | Thread Index | Old Index