提交 1ce14b62 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

less embarassing dirname hash function

上级 5232ea06
......@@ -602,7 +602,10 @@ namecmp(const char *s, const char *t)
u64
namehash(const strbuf<DIRSIZ> &n)
{
return n._buf[0]; /* XXX */
u64 h = 0;
for (int i = 0; i < DIRSIZ && n._buf[i]; i++)
h = ((h << 8) ^ n._buf[i]) % 0xdeadbeef;
return h;
}
void
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论