From: Joseph Myers <joseph@codesourcery.com>
To: "Ondřej Bílka" <neleai@seznam.cz>
Cc: <libc-alpha@sourceware.org>
Subject: Re: [PATCH 2/3] Optimize strchrnul with unrolling, better header and unaligned loads
Date: Thu, 28 May 2015 17:45:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.10.1505281659460.16930@digraph.polyomino.org.uk> (raw)
In-Reply-To: <20150526180007.GB26817@domone>
[-- Attachment #1: Type: text/plain, Size: 687 bytes --]
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)?
--
Joseph S. Myers
joseph@codesourcery.com
next prev parent reply other threads:[~2015-05-28 17:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-26 18:48 [PATCH 1/3] Use generic strchrnul for strchr Ondřej Bílka
2015-05-26 18:51 ` [PATCH 2/3] Optimize strchrnul with unrolling, better header and unaligned loads Ondřej Bílka
2015-05-28 17:45 ` Joseph Myers [this message]
2015-05-28 17:48 ` Ondřej Bílka
2015-05-26 18:55 ` [RFC PATCH 3/3] Exploit that strchr needle is mostly ascii Ondřej Bílka
2015-05-26 20:34 ` [RFC PATCH 4/3] Fix previous patch and add header Ondřej Bílka
2015-05-26 20:38 ` Ondřej Bílka
2015-05-28 17:49 ` Joseph Myers
2015-05-28 17:59 ` Ondřej Bílka
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=alpine.DEB.2.10.1505281659460.16930@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=neleai@seznam.cz \
/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).