public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>,
	'GNU C Library' <libc-alpha@sourceware.org>
Subject: Re: [PATCH] Replace rawmemchr (s, '\0') with strchr
Date: Fri, 3 Feb 2023 17:19:40 -1000	[thread overview]
Message-ID: <4514eccc-02fb-91e6-a770-bae744baebc2@linaro.org> (raw)
In-Reply-To: <PAWPR08MB8982465AA81002DA2D8141EC83D79@PAWPR08MB8982.eurprd08.prod.outlook.com>

On 2/3/23 03:07, Wilco Dijkstra via Libc-alpha wrote:
> Almost all uses of rawmemchr find the end of a string.  Since most targets use a
> generic implementation, replacing it with strchr is better since that is optimized
> by compilers into strlen (s) + s.  Also fix generic rawmemchr implementation to use
> a cast to unsigned char on the char input.

While the compiler does lower the strchr to strlen, why not use that replacement directly?


r~

  parent reply	other threads:[~2023-02-04  3:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03 13:07 Wilco Dijkstra
2023-02-03 13:43 ` Adhemerval Zanella Netto
2023-02-04  3:19 ` Richard Henderson [this message]
2023-02-04 11:38   ` Wilco Dijkstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4514eccc-02fb-91e6-a770-bae744baebc2@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).