使用std::hash进行哈希算法优化
This commit is contained in:
parent
95392c19c3
commit
cfca0d1cea
|
|
@ -359,14 +359,8 @@ int e2d::String::getLength() const
|
||||||
|
|
||||||
unsigned int e2d::String::getHashCode() const
|
unsigned int e2d::String::getHashCode() const
|
||||||
{
|
{
|
||||||
unsigned int hash = 0;
|
std::hash<std::wstring> hash;
|
||||||
|
return hash(_str);
|
||||||
for (size_t i = 0, length = _str.size(); i < length; ++i)
|
|
||||||
{
|
|
||||||
hash *= 16777619;
|
|
||||||
hash ^= (unsigned int)towupper(_str[i]);
|
|
||||||
}
|
|
||||||
return hash;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring e2d::String::getWString() const
|
std::wstring e2d::String::getWString() const
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue