diff options
| author | dsl <dsl@NetBSD.org> | 2009-07-11 08:48:51 +0000 |
|---|---|---|
| committer | dsl <dsl@NetBSD.org> | 2009-07-11 08:48:51 +0000 |
| commit | 5acd65fcb7bdfed7bf4ad681f5e8db8ee8d22f4b (patch) | |
| tree | 8186b848af0b59c0a3a6c3abcd2d563c8d7fe719 /common/lib/libc | |
| parent | 9a7f03a6bbe0cbad68c1e6b1ab911f518765860e (diff) | |
Change comments about algorithms, 99.6% for random data isn't 'rare' in my book!
(The 'rare' case is any byte values 0x80-0xff.)
Diffstat (limited to 'common/lib/libc')
| -rw-r--r-- | common/lib/libc/arch/x86_64/string/strlen.S | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/common/lib/libc/arch/x86_64/string/strlen.S b/common/lib/libc/arch/x86_64/string/strlen.S index 69b3538a8f2..3d171917307 100644 --- a/common/lib/libc/arch/x86_64/string/strlen.S +++ b/common/lib/libc/arch/x86_64/string/strlen.S @@ -6,7 +6,7 @@ #include <machine/asm.h> #if defined(LIBC_SCCS) - RCSID("$NetBSD: strlen.S,v 1.1 2005/12/20 19:28:51 christos Exp $") + RCSID("$NetBSD: strlen.S,v 1.2 2009/07/11 08:48:51 dsl Exp $") #endif ENTRY(strlen) @@ -74,9 +74,9 @@ ENTRY(strlen) * (3) ((x - 0x01....01) & 0x80....80) * * always evaluates to a non-zero value if any of the bytes in - * the original word is zero. However, in rare cases, it also - * evaluates to a non-zero value when none of the bytes in the - * original word is zero. + * the original word is zero or has the top bit set. + * For strings that are likely to only contain 7-bit ascii these + * false positives will be rare. * * To account for possible false positives, each byte of the * original word must be checked when the expression evaluates to @@ -110,7 +110,7 @@ ENTRY(strlen) je .Lloop /* - * In rare cases, the above loop may exit prematurely. We must + * For bytes 0x80-0xff the above loop will exit prematurely. We must * return to the loop if none of the bytes in the word equal 0. */ cmpb $0,-8(%rax) /* 1st byte == 0? */ |
