diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-07-10 02:15:01 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-07-10 02:15:01 +0000 |
commit | 7b8cb00259043365e001992229dfaf50c60dd66b (patch) | |
tree | a26e03951845560eb856957ffcee9c6158484251 /src/fstring.cpp | |
parent | 32c48edc85e05bedc6324109e8a5429767dda42a (diff) | |
download | libbu++-7b8cb00259043365e001992229dfaf50c60dd66b.tar.gz libbu++-7b8cb00259043365e001992229dfaf50c60dd66b.tar.bz2 libbu++-7b8cb00259043365e001992229dfaf50c60dd66b.tar.xz libbu++-7b8cb00259043365e001992229dfaf50c60dd66b.zip |
More FString updates, this one fixes the hashing and string comparison.
Diffstat (limited to '')
-rw-r--r-- | src/fstring.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/fstring.cpp b/src/fstring.cpp index f71d6c1..429dfef 100644 --- a/src/fstring.cpp +++ b/src/fstring.cpp | |||
@@ -3,7 +3,16 @@ | |||
3 | 3 | ||
4 | template<> uint32_t Bu::__calcHashCode<Bu::FString>( const Bu::FString &k ) | 4 | template<> uint32_t Bu::__calcHashCode<Bu::FString>( const Bu::FString &k ) |
5 | { | 5 | { |
6 | return __calcHashCode( k.c_str() ); | 6 | long j, sz = k.getSize(); |
7 | const char *s = k.getStr(); | ||
8 | |||
9 | long nPos = 0; | ||
10 | for( j = 0; j < sz; j++, s++ ) | ||
11 | { | ||
12 | nPos = *s + (nPos << 6) + (nPos << 16) - nPos; | ||
13 | } | ||
14 | |||
15 | return nPos; | ||
7 | } | 16 | } |
8 | 17 | ||
9 | template<> bool Bu::__cmpHashKeys<Bu::FString>( | 18 | template<> bool Bu::__cmpHashKeys<Bu::FString>( |