diff options
| author | nijtmans <nijtmans> | 2010-02-25 22:20:10 (GMT) |
|---|---|---|
| committer | nijtmans <nijtmans> | 2010-02-25 22:20:10 (GMT) |
| commit | 05500753109da62940c20a012f122fb5826764e7 (patch) | |
| tree | ffa352ca883f0018c5d14cbd41b0f6917c0a97ad /generic/tclHash.c | |
| parent | 7b7ae562d358bcf6cdf3af0ea558ab315314c49c (diff) | |
| download | tcl-05500753109da62940c20a012f122fb5826764e7.zip tcl-05500753109da62940c20a012f122fb5826764e7.tar.gz tcl-05500753109da62940c20a012f122fb5826764e7.tar.bz2 | |
[ tcl-Feature Requests-2958832 ] Further
speed-up of ouster-hash function.
Eliminate various unnecessary (ClientData)
type casts.
Diffstat (limited to 'generic/tclHash.c')
| -rw-r--r-- | generic/tclHash.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/generic/tclHash.c b/generic/tclHash.c index a7d6b40..7647db0 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclHash.c,v 1.44 2010/02/24 10:45:04 dkf Exp $ + * RCS: @(#) $Id: tclHash.c,v 1.45 2010/02/25 22:20:10 nijtmans Exp $ */ #include "tclInt.h" @@ -871,8 +871,8 @@ HashStringKey( Tcl_HashTable *tablePtr, /* Hash table. */ void *keyPtr) /* Key from which to compute hash value. */ { - register const char *string = (const char *) keyPtr; - register unsigned int result = 0; + register const char *string = keyPtr; + register unsigned int result; register char c; /* @@ -903,10 +903,14 @@ HashStringKey( * * See also HashString in tclLiteral.c. * See also TclObjHashKey in tclObj.c. + * + * See [tcl-Feature Request #2958832] */ - for (; (c=*string++) != 0 ;) { - result += (result<<3) + UCHAR(c); + if ((result = UCHAR(*string)) != 0) { + while ((c = *++string) != 0) { + result += (result << 3) + UCHAR(c); + } } return result; } |
