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

Bruce Richardson bruce.richardson at intel.com
Fri Jan 6 12:48:17 CET 2023


On Thu, Jan 05, 2023 at 04:32:40PM -0800, Stephen Hemminger wrote:
> On Thu, 5 Jan 2023 09:21:18 -0800
> Tyler Retzlaff <roretzla at linux.microsoft.com> wrote:
> 
> > 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.
> 
> We could but the project needs to support older RHEL releases
> which have older tool sets. Though probably this is moot point given
> how much meson seems to change.

True, though meson tends to be a bit easier to update than GCC on a system
- no "pip3 install --upgrade gcc", sadly :-)

If we can't go all the way to C11 support, how about at least going to C99
support? As far as I know DPDK has never updated its minimum C-standard
version, and it might be a good idea to start the process of doing so, even
if it is a baby step.

/Bruce


More information about the dev mailing list