#pragma once #include #include #include #include #include "rage/joaat.hpp" namespace rage { template struct constexpr_joaat { char data[CharCount]; template constexpr constexpr_joaat(const char *str, std::index_sequence) : data{ (str[Indices])... } {} constexpr joaat_t operator()() { joaat_t hash = 0; for (std::size_t i = 0; i < CharCount; ++i) { hash += joaat_to_lower(data[i]); hash += (hash << 10); hash ^= (hash >> 6); } hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); return hash; } }; } #define RAGE_JOAAT_IMPL(str) (::rage::constexpr_joaat((str), std::make_index_sequence())()) #define RAGE_JOAAT(str) (std::integral_constant::value)