This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: rawmemchr

On Wed, May 21, 2008 at 10:33:05PM +0000, Eric Blake wrote:
>Eric Blake <ebb9 <at>> writes:
>> Here's my test program:
>>       int *ptr = (int *) str;
>>       while (!DETECTNULL (*ptr) && !DETECTCHAR (*ptr, mask))
>>         ptr++;
>>       /* Found the end of string or word containing c.  */
>>       str = (const char *) str;
>FYI.  That was supposed to be
>str = (const char *) ptr;
>That one-character flaw in my test app C code resulted in searching the string 
>twice (once fast and discarding the progress, then again bytewise).  With the 
>test app fixed, I get these even more impressive numbers to demonstrate the 
>benefits of my optimization:

I really don't want to be a wet blanket here but I'm worried about
changing something as fundamental as strchr based on one simple test
program and the assurances of a programmer that everything is fine.

It really seems to me that there should be proven optimized versions of
these functions floating around which don't rely on more tweaking in
May of 2008.

I know that Eric is an exceptional programmer but I hope that more
people will be doing a sanity check on this code.  This is not a
function that can have bugs.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]