Messages in this thread | | | Date | Thu, 28 Oct 1999 16:31:41 -0500 | From | Tim Walberg <> | Subject | Re: [PATCH] strlen |
| |
On 10/28/1999 22:28 +0200, Arjan van de Ven wrote: >> > Here is an optimized strlen function for i586+ processors, it works by >> > testing 4 bytes at a time and averages 1.8 clock cycles per byte (scas = >> > 4n). >> >> This, I think, is a problem on i386. You _cannot_ read beyond the end of the >> string (might be on an other, unmapped page), but you don't know that until >> you do, when doing 4 bytes at a time. I mean: You can only know that you >> went to far... >>
However, if it's written right (I haven't looked at the code, so I don't know), and only accesses 32-bit aligned words with special cases for the front and back of the string, where alignment may be off, it should work. It would IMHO be extremely odd for a word-aligned word to cross a page boundary...
tw
-- +------------------------------+--------------------------+ | Tim Walberg | Phone: 847-782-2472 | | TERAbridge Technologies Corp | FAX: 847-623-1717 | | 1375 Tri-State Parkway | twalberg@terabridge.com | | Gurnee, IL 60031 | 800-SKY-TEL2 PIN 9353299 | +------------------------------+--------------------------+ [unhandled content-type:application/pgp-signature] | |