[PATCH v2 1/2] eal: provide leading and trailing zero bit count abstraction

Tyler Retzlaff roretzla at linux.microsoft.com
Thu Jan 5 18:21:18 CET 2023


On Thu, Jan 05, 2023 at 10:01:31AM +0100, Thomas Monjalon wrote:
> 05/01/2023 08:09, Morten Brørup:
> > > From: Tyler Retzlaff [mailto:roretzla at linux.microsoft.com]
> > > +/**
> > > + * @warning
> > > + * @b EXPERIMENTAL: this API may change, or be removed, without prior
> > > notice
> > > + *
> > > + * Get the count of leading 0-bits in v.
> > > + *
> > > + * @param v
> > > + *   The value.
> > > + * @return
> > > + *   The count of leading zero bits.
> > > + */
> > > +__rte_experimental
> > > +static inline unsigned int
> > > +rte_clzl(unsigned long v)
> > 
> > Don't use l (long) and ll (long long) for names (and types), use explicit bit lengths, 32 and 64.
> > 
> > E.g.: rte_clz32(uint32_t v)
> 
> I agree on using numbers.
> 

love the idea, fewer functions too.

though it is a shame we cannot adopt C11 standard because we could just
do away with the bit suffixes entirely.


More information about the dev mailing list