This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Optimize strchr (x, 0)
- From: Roland McGrath <roland at hack dot frob dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: Andreas Schwab <schwab at linux-m68k dot org>, libc-alpha at sourceware dot org
- Date: Fri, 8 Mar 2013 13:48:47 -0800 (PST)
- Subject: Re: [PATCH] Optimize strchr (x, 0)
- References: <20130224104344.GA24812@domone.kolej.mff.cuni.cz><m238wmaqkb.fsf@linux-m68k.org><20130308152319.GA10562@domone.kolej.mff.cuni.cz>
> * string/bits/string2.h: Add stplen macro.
> (rawmemchr) Optimize case rawmemchr(x, 0).
> (strchr) Use stplen.
> (strcat) Likewise.
Should be:
* string/bits/string2.h (__stplen): New macro.
[!_HAVE_STRING_ARCH_strchr] [!__GNUC_PREEQ (3, 2)] (strchr): Use it.
[! HAVE_STRING_ARCH_strncat] [_USE_STRING_ARCH_strchr] (strncat):
Likewise.
[!_HAVE_STRING_ARCH_rawmemchr] (__rawmemchr): New macro;
optimizes the case of searching for '\0'.