Template
1
0
This commit is contained in:
2025-06-25 23:28:51 +03:00
parent c023c5f5ed
commit bc8523b73e
2 changed files with 1 additions and 1 deletions

View File

@@ -1,19 +0,0 @@
// Big thanks to
// https://medium.com/@ryan_forrester_/using-switch-statements-with-strings-in-c-a-complete-guide-efa12f64a59d
#include <cstddef>
#include <cstdint>
#include <string_view>
// This is called a polynomial rolling hash, prob going to collide
namespace Helpers {
constexpr uint64_t Pathhash(std::string_view s) {
uint64_t res = 0;
for (uint8_t c : s) {
res = (res * 131) + c;
}
return res;
}
} // namespace Helpers
constexpr uint64_t operator""_hash(const char *string, std::size_t count) {
return Helpers::Pathhash(std::string_view(string));
}