20 lines
392 B
C++
20 lines
392 B
C++
|
|
#include <string_view>
|
|
#ifndef NAME
|
|
|
|
#define NAME "ParaDocs"
|
|
#define VERSION "0.0.1"
|
|
|
|
inline constexpr auto hash_djb2a(const std::string_view sv) {
|
|
unsigned long hash{5381};
|
|
for (unsigned char c : sv) {
|
|
hash = ((hash << 5) + hash) ^ c;
|
|
}
|
|
return hash;
|
|
}
|
|
|
|
inline constexpr auto operator""_sh(const char* str, size_t len) {
|
|
return hash_djb2a(std::string_view{str, len});
|
|
}
|
|
|
|
#endif |