aboutsummaryrefslogtreecommitdiff
path: root/src/stable/hash.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-05 22:41:51 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-05 22:41:51 +0000
commitec05778d5718a7912e506764d443a78d6a6179e3 (patch)
tree78a9a01532180030c095acefc45763f07c14edb8 /src/stable/hash.cpp
parentb20414ac1fe80a71a90601f4cd1767fa7014a9ba (diff)
downloadlibbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.gz
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.bz2
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.xz
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.zip
Converted tabs to spaces with tabconv.
Diffstat (limited to '')
-rw-r--r--src/stable/hash.cpp68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/stable/hash.cpp b/src/stable/hash.cpp
index f44104b..85a13c7 100644
--- a/src/stable/hash.cpp
+++ b/src/stable/hash.cpp
@@ -12,58 +12,58 @@ namespace Bu { subExceptionDef( HashException ) }
12template<> 12template<>
13uint32_t Bu::__calcHashCode<const char *>( const char * const &k ) 13uint32_t Bu::__calcHashCode<const char *>( const char * const &k )
14{ 14{
15 if (k == NULL) 15 if (k == NULL)
16 { 16 {
17 return 0; 17 return 0;
18 } 18 }
19 19
20 unsigned long int nPos = 0; 20 unsigned long int nPos = 0;
21 for( const char *s = k; *s; s++ ) 21 for( const char *s = k; *s; s++ )
22 { 22 {
23 nPos = *s + (nPos << 6) + (nPos << 16) - nPos; 23 nPos = *s + (nPos << 6) + (nPos << 16) - nPos;
24 } 24 }
25 25
26 return nPos; 26 return nPos;
27} 27}
28 28
29template<> bool Bu::__cmpHashKeys<const char *>( const char * const &a, const char * const &b ) 29template<> bool Bu::__cmpHashKeys<const char *>( const char * const &a, const char * const &b )
30{ 30{
31 if( a == b ) 31 if( a == b )
32 return true; 32 return true;
33 33
34 for(int j=0; a[j] == b[j]; j++ ) 34 for(int j=0; a[j] == b[j]; j++ )
35 if( a[j] == '\0' ) 35 if( a[j] == '\0' )
36 return true; 36 return true;
37 37
38 return false; 38 return false;
39} 39}
40 40
41template<> 41template<>
42uint32_t Bu::__calcHashCode<char *>( char * const &k ) 42uint32_t Bu::__calcHashCode<char *>( char * const &k )
43{ 43{
44 if (k == NULL) 44 if (k == NULL)
45 { 45 {
46 return 0; 46 return 0;
47 } 47 }
48 48
49 unsigned long int nPos = 0; 49 unsigned long int nPos = 0;
50 for( const char *s = k; *s; s++ ) 50 for( const char *s = k; *s; s++ )
51 { 51 {
52 nPos = *s + (nPos << 6) + (nPos << 16) - nPos; 52 nPos = *s + (nPos << 6) + (nPos << 16) - nPos;
53 } 53 }
54 54
55 return nPos; 55 return nPos;
56} 56}
57 57
58template<> bool Bu::__cmpHashKeys<char *>( char * const &a, char * const &b ) 58template<> bool Bu::__cmpHashKeys<char *>( char * const &a, char * const &b )
59{ 59{
60 if( a == b ) 60 if( a == b )
61 return true; 61 return true;
62 62
63 for(int j=0; a[j] == b[j]; j++ ) 63 for(int j=0; a[j] == b[j]; j++ )
64 if( a[j] == '\0' ) 64 if( a[j] == '\0' )
65 return true; 65 return true;
66 66
67 return false; 67 return false;
68} 68}
69 69