[PATCH] add memrchr(3)
Christopher Faylor
cgf-use-the-mailinglist-please@sourceware.org
Thu May 10 07:00:00 GMT 2012
On Wed, May 09, 2012 at 10:17:21AM -0500, Yaakov (Cygwin/X) wrote:
>On Wed, 2012-05-09 at 10:48 -0400, Christopher Faylor wrote:
>> Why not just grab the source from FreeBSD?
>>
>> http://svnweb.freebsd.org/base/head/lib/libc/string/memrchr.c?revision=178051&view=markup
>>
>> (or actually from OpenBSD since that's where the above originated)
>
>That would have been easy, but then everyone would be complaining that
>its not optimized for speed. :-)
Yeah, that's usually the response whenever I make this suggestion. I'll
give my usual response to that response:
1) This code is good enough for an OS used by thousands of people.
2) We've already seen that it's possible to do a flawed implementation
(no offense intended) so we're relying on catching bugs with code
inspection rather than using something with a known track record. Given
that this is not a function which is used a whole lot, I don't see why
we'd have to worry about extreme optimization.
Also, there is at least one assembly version of this function floating
around. It has a binary documentation requirement but there may be
other optimized versions around too.
More information about the Newlib
mailing list