Changeset 226
- Timestamp:
- 04/18/14 01:51:17 (11 years ago)
- Location:
- cpp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/nonstd_math.cpp
r197 r226 24 24 25 25 26 #if defined LINUX || defined TIZEN 26 #if defined LINUX || defined TIZEN || defined __ANDROID__ 27 27 28 28 #include <fenv.h> -
cpp/frams/util/hashtable.cpp
r197 r226 5 5 #include "hashtable.h" 6 6 7 int HashTable::hash(const char *s)7 int HashTable::hash(const SString &s) 8 8 { 9 int h=0; 10 char c; 11 while(c=*(s++)) 12 h=31*h+c; 13 return h&0x7fffffff; 9 return s.hash()&0x7fffffff; 14 10 } 15 11 -
cpp/frams/util/hashtable.h
r197 r226 31 31 long sync; 32 32 33 int hash(const char *s);33 int hash(const SString &s); 34 34 void rehash(int newsize); 35 35 public: -
cpp/frams/util/sstring.cpp
r222 r226 116 116 117 117 #define FNV_32_PRIME ((Fnv32_t)0x01000193) 118 119 Fnv32_t fnv_32_buf(void *buf, size_t len, Fnv32_t hval) 118 #define FNV1_32_INIT ((Fnv32_t)0x811c9dc5) 119 #define FNV1_32A_INIT FNV1_32_INIT 120 121 Fnv32_t fnv_32a_buf(void *buf, size_t len, Fnv32_t hval) 120 122 { 121 123 unsigned char *bp = (unsigned char *)buf; /* start of buffer */ … … 123 125 124 126 while (bp < be) { 127 128 /* xor the bottom with the current octet */ 129 hval ^= (Fnv32_t)*bp++; 125 130 126 131 /* multiply by the 32 bit FNV magic prime mod 2^32 */ … … 131 136 #endif 132 137 133 /* xor the bottom with the current octet */134 hval ^= (Fnv32_t)*bp++;135 138 } 136 139 … … 142 145 unsigned long SBuf::hash() const 143 146 { 144 return fnv_32 _buf(txt,used,FNV_32_PRIME);147 return fnv_32a_buf(txt,used,FNV1_32A_INIT); 145 148 } 146 149
Note: See TracChangeset
for help on using the changeset viewer.