This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Use strlen when searching for a nul char
- From: Andreas Schwab <schwab at suse dot de>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: <pinskia at gmail dot com>, Wilco Dijkstra <wdijkstr at arm dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 07 Oct 2015 17:30:00 +0200
- Subject: Re: [PATCH] Use strlen when searching for a nul char
- Authentication-results: sourceware.org; auth=none
- References: <003a01d1010c$ad404240$07c0c6c0$ at com> <5F638E7C-B8BD-4F94-8278-1F8B359CACCA at gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1510071505450 dot 29388 at digraph dot polyomino dot org dot uk>
Joseph Myers <joseph@codesourcery.com> writes:
> (And please accompany performance claims such as "faster on most targets"
> with figures from the benchtests or a reason it's hard to produce such
> figures. In this case I think the transformation could be justified for
> GCC as something architecture-independent without specific performance
> claims - strlen being inherently simpler because it only ever has to
> search for 0 bytes, so it should never be asymptotically slower than the
> alternative and may be faster.)
On the debit side you have to keep the value of the pointer around in
order to add it afterwards.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."