diff options
| author | Stefan Boberg <[email protected]> | 2021-05-19 13:42:03 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-05-19 13:42:03 +0200 |
| commit | cd688c11814dfb54571a32519befe2232682ecce (patch) | |
| tree | 1e82d70aa57194a4c1c06875f972ffdb3d973d03 | |
| parent | Merge branch 'main' of https://github.com/EpicGames/zen into main (diff) | |
| download | zen-cd688c11814dfb54571a32519befe2232682ecce.tar.xz zen-cd688c11814dfb54571a32519befe2232682ecce.zip | |
Added HashStringDjb2()
| -rw-r--r-- | zencore/include/zencore/string.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/zencore/include/zencore/string.h b/zencore/include/zencore/string.h index d7727ca08..684e27827 100644 --- a/zencore/include/zencore/string.h +++ b/zencore/include/zencore/string.h @@ -590,6 +590,21 @@ ParseInt(const std::string_view& Input) ////////////////////////////////////////////////////////////////////////// +constexpr uint32_t +HashStringDjb2(const std::string_view& InString) +{ + uint32_t HashValue = 5381; + + for (int c : InString) + { + HashValue = HashValue * 33 + c; + } + + return HashValue; +} + +////////////////////////////////////////////////////////////////////////// + void string_forcelink(); // internal } // namespace zen |