Changeset 226 for cpp/frams/util/sstring.cpp
- Timestamp:
- 04/18/14 01:51:17 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.