mirror of
https://github.com/matrix-construct/construct
synced 2025-01-16 17:46:54 +01:00
ircd::util: Add bernstein hash overloads for 16bit chars.
This commit is contained in:
parent
e3e0d81828
commit
290fa43c43
1 changed files with 14 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue