Re: [PATCH v2 1/6] linux/log2.h: Add roundup/rounddown_pow_two64() family of functions

From: Nicolas Saenz Julienne
Date: Tue Nov 19 2019 - 07:43:49 EST


On Tue, 2019-11-19 at 12:30 +0100, Nicolas Saenz Julienne wrote:
> Hi Andrew, thanks for the review.
> > > +/**
> > > + * __roundup_pow_of_two64() - round 64bit value up to nearest power of
> > > two
> > > + * @n: value to round up
> > > + */
> > > +static inline __attribute__((const)) __u64 __roundup_pow_of_two64(__u64
> > > n)
> >
> > To be consistent with other functions in the same file (__ilog_u64) you may
> > want to rename this to __roundup_pow_of_two_u64.
>
> Sounds good to me.
>
> > Also do you know why u64 is used in some places and __u64 in others?
>
> That's unwarranted, it should be __u64 everywhere.

Sorry, now that I look deeper into it, it should be u64.

> > > +{
> > > + return 1UL << fls64(n - 1);
> >
> > Does this need to be (and for the others):
> >
> > return 1ULL << fls64(n - 1);
> >
> > Notice that the PCI drivers you convert, all use 1ULL.
>
> Noted
>
> Regards,
> Nicolas
>

Attachment: signature.asc
Description: This is a digitally signed message part