ParaDocs/src/const.h
PoliEcho c3074bc8d4
Some checks failed
build_test / build (push) Failing after 2m8s
improved memory safety + misc QOL changes
2025-04-14 18:53:54 +02:00

20 lines
393 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