摘要: 将字符串Hash成整型存储经常用到BKDRHash算法uint64_t BKDRHash(const char *pszKey){ uint64_t seed = 131; register uint64_t uCode=0; while(pszKey[0]) { uCode = uCode *seed + (unsigned char)pszKey[0]; pszKey++; } return uCode;}选择了64位的key,减少冲突的概率。 阅读全文
posted @ 2012-12-21 09:14 gmark 阅读(727) 评论(0) 推荐(0)