bakatui/src/const.h
PoliEcho 33e8b490f5
Some checks failed
/ sync-to-origin (push) Has been cancelled
pls work
2025-11-08 16:55:39 +01:00

20 lines
394 B
C++

#include <string_view>
#ifndef VERSION
#define VERSION "1.0.3"
#define NAME "bakatui"
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