#pragma once #include "rage/joaat.hpp" #include #include #include #include namespace rage { template inline constexpr joaat_t consteval_joaat(char const (&data)[N]) { joaat_t hash = 0; for (std::size_t i = 0; i < N - 1; ++i) { hash += joaat_to_lower(data[i]); hash += (hash << 10); hash ^= (hash >> 6); } hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); return hash; } inline consteval joaat_t consteval_joaat(const std::span& data) { joaat_t hash = 0; for (std::size_t i = 0; i < data.size() - 1; ++i) { hash += joaat_to_lower(data[i]); hash += (hash << 10); hash ^= (hash >> 6); } hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); return hash; } static_assert(consteval_joaat("test") == 0x3f75ccc1); } #define RAGE_JOAAT_IMPL(str) (::rage::consteval_joaat(str)) #define RAGE_JOAAT(str) (std::integral_constant::value)