This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc 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]

[Bug libc/5807] strlen() not effective


------- Additional Comments From carlos at codesourcery dot com  2008-03-02 03:29 -------
The math is wrong. 

It looks glibc has a broken version of Alan Mycroft's HAKMEMC postings.
See: http://www.cl.cam.ac.uk/~am21/progtricks.html

The solution is "((x - 0x01010101) & ~x & 0x80808080)", but the "& ~x" is
missing from the glibc version.

The "#if 0" was added Tue Jan 21 03:39:54 1992 UTC (16 years, 1 month ago) by
roland, and the patch looked like this:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/generic/Attic/strlen.c.diff?r1=1.1&r2=1.2&cvsroot=glibc

I can reproduce this on cvs head. The generic strlen function is horribly
inefficient.

Roland can you comment on this? 

What's the legal status of using that algorithm?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|drepper at redhat dot com   |roland at redhat dot com
             Status|NEW                         |ASSIGNED


http://sourceware.org/bugzilla/show_bug.cgi?id=5807

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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