[PATCH 2/3] Optimize strchrnul with unrolling, better header and unaligned loads

Ondřej Bílka neleai@seznam.cz
Thu May 28 17:48:00 GMT 2015


On Thu, May 28, 2015 at 05:02:32PM +0000, Joseph Myers wrote:
> On Tue, 26 May 2015, Ondřej Bílka wrote:
> 
> > +static always_inline
> > +int
> > +found_in_long_bytes(char *s, unsigned long int cmask, char **result)
> > +{
> > +  const unsigned long int *lptr = (const unsigned long int *) s;
> > +  unsigned long int mask = contains_zero (*lptr) | contains_zero (*lptr ^ cmask);
> > +  if (mask)
> > +    {
> > +      *result = s + ffsl (mask) / 8 - 1;
> 
> If this gets used in strchr, note ffsl is in the user's namespace.  Are 
> you sure this will always be inlined by all supported GCC versions on all 
> supported architectures (or converted to a call to a libgcc __clz* 
> function, which is just as good in namespace terms)?
> 
No, i handle that problem of next iteration of this patch that uses
skeleton. And you need different function for big endian.



More information about the Libc-alpha mailing list