0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-07 19:18:35 +02:00

ircd::util: Add bernstein hash overloads for 16bit chars.

This commit is contained in:
Jason Volk 2016-11-03 16:49:41 -07:00
parent e3e0d81828
commit 290fa43c43

View file

@ -286,6 +286,20 @@ hash(const std::string &str,
return i >= str.size()? 7681ULL : (hash(str, i+1) * 33ULL) ^ str.at(i);
}
constexpr size_t
hash(const char16_t *const &str,
const size_t i = 0)
{
return !str[i]? 7681ULL : (hash(str, i+1) * 33ULL) ^ str[i];
}
inline size_t
hash(const std::u16string &str,
const size_t i = 0)
{
return i >= str.size()? 7681ULL : (hash(str, i+1) * 33ULL) ^ str.at(i);
}
/***
* C++14 user defined literals