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 - 06:30:54 EST


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.

> > +{
> > + 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